ale
ale

Reputation: 11820

What does this old PHP code mean - variable name on a single line?

I'm re-factoring this ugly pile of legacy code and I came across this:

// $log is a PEAR logging object 
$log->debug( 'some error message' ); 

with this immediately after:

$foo;
$bar;
...
...

I.e. Just a load of variable names within a function.. what does this do ? Nothing ?

Thanks :).

Upvotes: 1

Views: 104

Answers (2)

John Conde
John Conde

Reputation: 219804

They are variable declarations without values being assigned to them.

Upvotes: 2

Ry-
Ry-

Reputation: 224903

They're completely pointless and they don't declare the variables at all, as PHP has no concept of variable declaration, only assignment, and these statements don't assign anything to the variables. See an example using $variable; as compared to this example without $variable;; they have the same result.

Perhaps it's a coding style.

Upvotes: 2

Related Questions