Other incompatibilities

Example A-11. Migration from 2.0: concatenation for strings


echo "1" + "1";
   

In PHP 2.0 this would echo 11, in PHP 3.0 it would echo 2. Instead use:

echo "1"."1";
    

$a = 1;
$b = 1;
echo $a + $b;
    

This would echo 2 in both PHP 2.0 and 3.0.

$a = 1;
$b = 1;
echo $a.$b;
    
This will echo 11 in PHP 3.0.