[PHP] function().function() VS function()function()

Posted by kwokwai on Stack Overflow See other posts from Stack Overflow or by kwokwai
Published on 2010-04-29T10:29:28Z Indexed on 2010/04/29 10:47 UTC
Read the original article Hit count: 637

Filed under:

Hi all,

I was writing a foreach Loop in PHP5. Here is the script:

foreach(range('A','Z') as $char) // line 1
{ // line 2
echo strtoupper($char)strtolower($char); // line 3
} // line 4

And I got this error message Parse error: parse error, unexpected T_STRING in testing.php on line 3

I spent almost an hour to figure out I should add a dot between two functions like this:

echo strtoupper($char).strtolower($char);

So I can't tell the difference between these two lines of codes:

echo strtoupper($char).strtolower($char);
echo strtoupper($char)strtolower($char);

© Stack Overflow or respective owner

Related posts about php5