3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?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());
based on nWWvf
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.3.20 - 5.5.30
Parse error: syntax error, unexpected '.', expecting ',' or ';' in /in/KeWtd on line 11
Process exited with code 255.