3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace foo; define('LG', 'fr'); $sql = " SELECT id, titre FROM contenu_trad WHERE lg = '".LG."' "; var_dump($sql); class Url { private $lg = LG; private $sql = " SELECT id, titre FROM contenu_trad WHERE lg = '".$this->lg."' "; public function getSQL() { return $this->sql; } } $url = new Url; var_dump($url->getSQL());
Output for 7.0.0
Fatal error: Constant expression contains invalid operations in /in/KeWtd on line 11
Process exited with code 255.
Output for 5.6.8 - 5.6.16
Parse error: syntax error, unexpected '$this' (T_VARIABLE) in /in/KeWtd on line 11
Process exited with code 255.
Output for 5.5.24 - 5.5.30
Parse error: syntax error, unexpected '.', expecting ',' or ';' in /in/KeWtd on line 11
Process exited with code 255.

preferences:
191.98 ms | 1399 KiB | 24 Q