homelessDevOps
homelessDevOps

Reputation: 20726

PHP Code - no idea if it does something

i have the following code snippet, in an appliation working with Zend Framework. I know what Zend Date does.. thats not the problem.

But the coder simply calls "$date" , and i dont know if this does something?

         $date = new Zend_Date(time());
         $date->addDay(1);
         $date; 
         // save date, or do something else
         ...

Upvotes: 1

Views: 136

Answers (4)

balupton
balupton

Reputation: 48640

It adds a day to $date. Where is the confusion? The 3rd line does nothing.

Upvotes: 0

Bogdan Constantinescu
Bogdan Constantinescu

Reputation: 5356

Maybe it had other use before, like echo $date;. Just writing a variable does absolutely nothing.

Upvotes: 0

selfawaresoup
selfawaresoup

Reputation: 15832

As far as I can tell, it does nothing except using up some CPU cycles.

Upvotes: 2

Mike B
Mike B

Reputation: 32145

I can't imagine a situation where simply stating a variable, whether it be an object, string, or otherwise, would perform some kind of action. It might just be a mistake.

Upvotes: 3

Related Questions