3v4l.org

run code in 300+ PHP versions simultaneously
<?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 git.master, git.master_jit, rfc.property-hooks

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
43.42 ms | 401 KiB | 8 Q