mootools php faith camera linux


Possible PHP Parser

Perplexing PHP Parser Ponderance

Is this an error in the parser or just a feature of the language?

// what will this print out in php5?

$earth 'World';
$string1 "Hello ".
$string2 $earth.'!';  
$string $string1.$string2;

// did you catch it, or did you run it to find out?

  // here it is again in slow motion:

  // note that this fooling of the parsing error
  // is quickly given away by showing E_NOTICE..

// begin with a variable
$earth 'World';

// now create the first line of
  // multi-line concatenation
$string1 "Hello ".

// now add in the single exclamation
$string2 $earth.'!';  // $string2 is now equal to World!

  // now concatenate "Hello " to "World!"
$string $string1.$string2;

'string1: '.$string1."n"//string1: Hello World!
echo 'string2: '.$string2."n"//string2: World!
echo 'string: '.$string."n";   //string: Hello World!World!

  // is this an error in the parser?
  // feature-not-bug?
  // internal assignment nonsense?

Last Updated: 2011-06-09 22:43:29
Creative Commons License Jay Johnston is a Zend Certified Engineer in PHP 5 LPI-ID: LPI000102450, Verfication Code: wmnnt56y2k  ... Jay Johnston is certified as LPIC-1 by the Linux Professional Institute