3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class X { /** * Default store code * * @var string */ protected $_currentStore; public function getStore($id = null) { $id_int = $id; if (!isset($id_int) || ''===$id_int || $id_int === true) { $id_int = $this->_currentStore; echo 'assigning $id_int to $this->_currentStore :: '; } echo 'using id class : ' . get_class($id_int) . ' :: '; if (!isset($id_int)) { echo '$id_int is not set? it has a class=' . get_class($id_int); } return $id_int; } } $x = new X(); $store = $x->getStore();
based on BjFXe
Output for 5.3.1 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
assigning $id_int to $this->_currentStore :: using id class : X :: $id_int is not set? it has a class=X
Output for 5.3.0
assigning $id_int to $this->_currentStore :: Warning: get_class() expects parameter 1 to be object, null given in /in/cMqLR on line 19 using id class : :: Warning: get_class() expects parameter 1 to be object, null given in /in/cMqLR on line 22 $id_int is not set? it has a class=
Output for 5.0.0 - 5.2.17
assigning $id_int to $this->_currentStore :: using id class : :: $id_int is not set? it has a class=
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/cMqLR on line 9
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/cMqLR on line 9
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or `T_VAR' or `'}'' in /in/cMqLR on line 9
Process exited with code 255.