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);
The ‘.’ is a concatenation operator. It returns the concatenation of its right and left arguments.
For example:
gives:
Having two functions next to each other without any operators is an error.