3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class Profile_Model_Profile { protected $_userId; protected $_email; protected $_firstName; protected $_lastName; protected $_midName; /** * @var Core_Model_File */ protected $_cvFile; /** * @var Profile_Model_Affil */ protected $_affil; public function __isset($key) { return isset($this->{'_' . self::toCamelCase($key)}); } public function __get($key) { $property = '_' . self::toCamelCase($key); if (property_exists($this, $property)) { return $property; } throw new RuntimeException(sprintf('Invalid property: %s', $property)); } public function __set($key, $value) { $key = self::toCamelCase($key); $setter = 'set' . $key; if (method_exists($this, $setter)) { return $this->{$setter}($value); } $property = '_' . $key; if (property_exists($this, $property)) { $this->{$property} = $value; return; } throw new RuntimeException(sprintf('Invalid property: %s', $property)); } /** * Transform given string to camel-case. * * @param string $str * @return string */ public static function toCamelCase($str) { if (is_array($str) && isset($str[1])) { return strtoupper($str[1]); } return preg_replace_callback( '/_(\w)/', array(__CLASS__, __FUNCTION__), (string) $str ); } }
Output for 5.0.0 - 5.6.28, hhvm-3.10.0 - 3.13.2, 7.0.0 - 7.1.0
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/9iTXH on line 5
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/9iTXH on line 5
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/9iTXH on line 5
Process exited with code 255.