I am wanting to know if there is any extra overhead of using an Object in PHP instead of using a static method based on my examples below?
Sesseion object from Session class
$session = new Session;
$session->set(user_id, $uswer_id); //set session var
$session->get(user_id); // get session var
VS
Static methods from Session class
Session::set(user_id, $uswer_id); //set session var
Session::get(user_id); // get session var
There will be a little overhead because an object needs to be created and placed in memory. But the question is, is it noticeable.
My opinion is that you should look to what works the most convenient. This kind of optimizations are mostly micro optimizations