3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Maniple_Model { public function __construct(array $data = null) { if ($data) { $this->setFromArray($data); } } public function setFromArray(array $data) { foreach ($data as $key => $value) { $this->__set($key, $value, false); } return $this; } /** * @param string $key * @return bool */ public function __isset($key) // {{{ { return isset($this->{'_' . self::toCamelCase($key)}); } // }}} /** * @param string $key * @return mixed * @throws InvalidArgumentException */ public function __get($key) // {{{ { $property = '_' . self::toCamelCase($key); if (property_exists($this, $property)) { return $property; } throw new InvalidArgumentException(sprintf('Invalid property: %s', $key)); } // }}} /** * @param string $key * @param mixed $value * @return void * @throws InvalidArgumentException */ public function __set($key, $value, $throw = true) // {{{ { $key = self::toCamelCase($key); $setter = 'set' . $key; if (method_exists($this, $setter)) { $this->{$setter}($value); return; } $property = '_' . $key; if (property_exists($this, $property)) { $this->{$property} = $value; return; } throw new InvalidArgumentException(sprintf('Invalid property: %s', $key)); } // }}} /** * 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 ); } // }}} }

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
5.4.250.0060.03612.42
5.4.240.0030.05719.09
5.4.230.0100.04718.99
5.4.220.0030.06318.96
5.4.210.0070.05019.11
5.4.200.0070.05318.74
5.4.190.0170.07018.75
5.4.180.0100.04718.76
5.4.170.0100.05319.09
5.4.160.0070.05018.63
5.4.150.0070.05718.73
5.4.140.0100.05016.35
5.4.130.0170.04016.53
5.4.120.0030.05316.61
5.4.110.0130.04716.34
5.4.100.0070.05016.46
5.4.90.0130.04316.62
5.4.80.0100.04316.37
5.4.70.0070.05016.50
5.4.60.0070.05016.54
5.4.50.0030.05016.44
5.4.40.0130.04716.54
5.4.30.0070.05016.57
5.4.20.0030.05016.30
5.4.10.0070.05016.36
5.4.00.0170.03715.79
5.3.280.0070.05014.67
5.3.270.0100.05014.52
5.3.260.0100.05014.71
5.3.250.0030.05314.84
5.3.240.0130.04714.59
5.3.230.0100.05014.75
5.3.220.0170.04014.65
5.3.210.0030.05714.76
5.3.200.0130.04714.67
5.3.190.0130.04314.66
5.3.180.0070.04714.80
5.3.170.0200.03314.60
5.3.160.0130.04314.58
5.3.150.0100.06714.41
5.3.140.0030.05014.79
5.3.130.0170.04014.39
5.3.120.0130.05714.58
5.3.110.0100.04714.78
5.3.100.0070.04713.95
5.3.90.0070.05014.16
5.3.80.0000.05714.10
5.3.70.0070.04714.11
5.3.60.0100.04314.11
5.3.50.0030.05314.02
5.3.40.0070.04713.79
5.3.30.0170.05714.00
5.3.20.0130.04713.54
5.3.10.0030.05013.64
5.3.00.0070.04713.66

preferences:
133.1 ms | 1398 KiB | 7 Q