3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { protected $prot; public $pub; public function init(){ $this->prot = rand(1,9); $this->pub = rand(1,9); } } function dehydrate($obj){ $class = get_class($obj); $exp = var_export($obj,1); return eval('return '.substr($exp,strpos($exp,'(')+1,-1).';'); } function hydrate($class,$dry=null){ static $hydrators = array(); $h = '_Hydrator__'.$class; if (empty($hydrators[$class])) { eval('class '.$h.' extends '.$class.' { static function __hydrate(array $array) { $o = new '.$class.'(); foreach ($array as $prop_name => $prop_value) $o->$prop_name = $prop_value; return $o; } } '); $hydrators[$class] = true; } return $dry?$h::__hydrate($dry):null; } $a = new Foo(); $a->init(); $dry = dehydrate($a); hydrate('Foo'); var_dump( hydrate('Foo',$dry) );

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)
7.2.110.0070.00716.64
7.2.100.0060.00916.63
7.2.90.0000.01116.52
7.2.80.0070.00716.82
7.2.70.0030.01016.89
7.2.60.0070.00717.07
7.2.50.0030.01316.70
7.2.40.0030.01316.94
7.2.30.0040.01116.91
7.2.20.0030.00616.97
7.2.10.0070.00716.89
7.2.00.0050.00918.06
7.1.230.0060.00615.82
7.1.220.0080.00015.97
7.1.210.0060.01015.94
7.1.200.0000.01415.99
7.1.190.0030.01015.83
7.1.180.0090.00315.95
7.1.170.0150.00015.60
7.1.160.0030.00915.77
7.1.150.0070.00715.92
7.1.140.0060.00615.73
7.1.130.0100.00315.89
7.1.120.0040.00715.62
7.1.110.0030.01015.56
7.1.100.0060.00615.75
7.1.90.0000.01315.97
7.1.80.0000.01615.83
7.1.70.0040.00916.58
7.1.60.0040.01317.72
7.1.50.0070.01016.18
7.1.40.0170.00015.85
7.1.30.0060.01215.79
7.1.20.0090.00915.56
7.1.10.0060.00615.77
7.1.00.0030.03019.00
7.0.310.0070.00715.11
7.0.300.0110.00015.35
7.0.290.0030.01015.50
7.0.280.0060.00615.19
7.0.270.0030.00915.55
7.0.260.0060.00315.44
7.0.250.0060.00615.59
7.0.240.0030.00715.52
7.0.230.0030.00915.58
7.0.220.0080.00415.59
7.0.210.0040.00815.47
7.0.200.0260.00214.90
7.0.190.0050.00315.54
7.0.180.0120.00315.27
7.0.170.0000.00815.49
7.0.160.0030.01015.41
7.0.150.0060.00615.14
7.0.140.0090.03618.78
7.0.130.0080.00415.46
7.0.120.0080.00415.65
7.0.110.0030.00815.58
7.0.100.0000.01215.57
7.0.90.0060.00615.40
7.0.80.0000.01115.41
7.0.70.2480.02617.59
7.0.60.0030.04517.80
7.0.50.0080.03316.65
7.0.40.0070.04716.75
7.0.30.0310.02716.94
7.0.20.0150.03216.79
7.0.10.0070.03016.86
7.0.00.0050.04916.88
5.6.380.0040.01114.71
5.6.370.0100.00314.29
5.6.360.0040.00814.76
5.6.350.0040.00814.23
5.6.340.0130.00314.64
5.6.330.0070.00614.39
5.6.320.0030.01014.48
5.6.310.0060.00614.50
5.6.300.0040.00814.61
5.6.290.0040.00414.78
5.6.280.0070.03617.80
5.6.270.0080.00414.61
5.6.260.0030.00614.73
5.6.250.0040.00414.75
5.6.240.0030.01014.52
5.6.230.0060.00614.54
5.6.220.0000.01414.68
5.6.210.0110.04117.44
5.6.200.0100.02516.22
5.6.190.0100.02317.49
5.6.180.0090.04917.47
5.6.170.0190.04517.53
5.6.160.0130.03717.50
5.6.150.0070.02216.25
5.6.140.0050.03016.37
5.6.130.0020.04016.33
5.6.120.0110.02117.79
5.6.110.0010.05017.84
5.6.100.0030.04017.78
5.6.90.0080.04417.76
5.6.80.0100.03817.51
5.6.70.0070.02617.29
5.6.60.0070.00714.40
5.6.50.0060.00614.27
5.6.40.0080.00814.38
5.6.30.0120.00314.44
5.6.20.0040.00414.48
5.6.10.0060.00914.29
5.6.00.0060.00614.31
5.5.380.0070.00312.79
5.5.370.0000.00812.79
5.5.360.0000.00712.79
5.5.350.0060.04016.60
5.5.340.0070.04215.37
5.5.330.0000.04716.50
5.5.320.0070.04416.51
5.5.310.0130.04516.54
5.5.300.0030.04615.37
5.5.290.0080.03915.37
5.5.280.0100.04316.80
5.5.270.0070.03916.83
5.5.260.0060.02516.72
5.5.250.0050.03616.74
5.5.240.0080.03016.48
5.5.230.0060.00612.79
5.5.220.0080.00312.79
5.5.210.0030.00712.79
5.5.200.0070.00312.79
5.5.190.0060.00612.79
5.5.180.0060.00612.79
5.5.170.0090.00314.02
5.5.160.0070.00312.79
5.5.150.0000.00712.79
5.5.140.0060.00612.79
5.5.130.0060.00312.79
5.5.120.0000.01112.79
5.5.110.0030.00612.79
5.5.100.0040.00412.79
5.5.90.0080.00412.79
5.5.80.0070.00312.79
5.5.70.0070.00412.79
5.5.60.0030.00912.79
5.5.50.0030.00312.79
5.5.40.0030.01012.79
5.5.30.0060.00612.79
5.5.20.0070.00712.79
5.5.10.0000.01112.79
5.5.00.0000.01112.79
5.4.450.0110.03316.14
5.4.440.0480.03416.07
5.4.430.0430.03316.12
5.4.420.0500.02916.20
5.4.410.0550.03016.18
5.4.400.0500.03015.96
5.4.390.0460.02715.97
5.4.380.0160.02615.69
5.4.370.0070.02715.63
5.4.360.0110.02015.68
5.4.350.0070.01712.41
5.4.340.0020.02412.41
5.4.330.0080.00312.79
5.4.320.0050.03012.66
5.4.310.0030.02412.65
5.4.300.0050.02212.65
5.4.290.0040.03112.65
5.4.280.0030.02412.60
5.4.270.0070.02412.60
5.4.260.0060.02412.60
5.4.250.0060.02312.60
5.4.240.0110.03215.87
5.4.230.0100.03515.92
5.4.220.0050.03115.86
5.4.210.0100.03715.81
5.4.200.0100.02515.94
5.4.190.0000.03215.79
5.4.180.0150.02715.84
5.4.170.0090.03815.88
5.4.160.0100.03315.77
5.4.150.0180.02515.87
5.4.140.0050.03114.68
5.4.130.0080.03714.59
5.4.120.0100.02214.71
5.4.110.0070.04014.66
5.4.100.0080.02514.58
5.4.90.0120.03214.62
5.4.80.0120.03314.63
5.4.70.0080.03014.70
5.4.60.0020.03214.59
5.4.50.0100.03314.62
5.4.40.0140.03014.66
5.4.30.0090.03014.62
5.4.20.0140.02714.71
5.4.10.0020.03414.58
5.4.00.0100.02414.34
5.3.290.0060.02012.80
5.3.280.0050.04013.81
5.3.270.0090.03013.72
5.3.260.0080.03313.75
5.3.250.0050.04013.75
5.3.240.0060.03313.79
5.3.230.0080.03713.79
5.3.220.0080.03613.60
5.3.210.0090.03313.68
5.3.200.0090.02513.69
5.3.190.0080.02713.69
5.3.180.0080.03413.68
5.3.170.0050.03013.77
5.3.160.0070.03013.73
5.3.150.0080.02613.64
5.3.140.0110.03313.68
5.3.130.0090.02613.76
5.3.120.0080.02713.59
5.3.110.0120.03213.71
5.3.100.0020.04213.46
5.3.90.0000.04413.41
5.3.80.0060.02613.41
5.3.70.0070.02913.33
5.3.60.0070.02713.44
5.3.50.0030.02813.39
5.3.40.0060.03613.37
5.3.30.0050.03213.36
5.3.20.0020.03013.21
5.3.10.0060.02813.23
5.3.00.0050.02813.31
5.2.170.0080.02011.96
5.2.160.0050.02212.05
5.2.150.0010.03112.01
5.2.140.0020.02611.88
5.2.130.0040.02311.98
5.2.120.0070.02012.04
5.2.110.0020.02511.94
5.2.100.0080.02811.96
5.2.90.0050.02811.86
5.2.80.0020.02311.98
5.2.70.0080.01811.89
5.2.60.0070.02511.97
5.2.50.0050.02212.02
5.2.40.0050.02011.89
5.2.30.0020.02611.88
5.2.20.0030.02211.92
5.2.10.0030.02311.87
5.2.00.0000.03411.80
5.1.60.0080.01711.32
5.1.50.0050.02211.52
5.1.40.0020.02111.51
5.1.30.0040.02011.48
5.1.20.0040.01911.57
5.1.10.0040.01711.48
5.1.00.0070.02511.46
5.0.50.0060.01210.75
5.0.40.0030.01710.65
5.0.30.0050.02210.51
5.0.20.0050.01210.54
5.0.10.0030.01310.56
5.0.00.0000.02410.58
4.4.90.0030.0179.32
4.4.80.0000.0139.31
4.4.70.0030.0139.29
4.4.60.0050.0139.29
4.4.50.0020.0179.32
4.4.40.0020.0229.38
4.4.30.0030.0159.31
4.4.20.0020.0119.34
4.4.10.0000.0169.35
4.4.00.0020.0239.32
4.3.110.0030.0119.31
4.3.100.0060.0089.26
4.3.90.0000.0139.22
4.3.80.0000.0239.22
4.3.70.0020.0119.26
4.3.60.0000.0139.29
4.3.50.0020.0139.26
4.3.40.0030.0179.25
4.3.30.0020.0128.70
4.3.20.0030.0118.67
4.3.10.0030.0128.62
4.3.00.0050.01310.08

preferences:
39.05 ms | 400 KiB | 5 Q