3v4l.org

run code in 300+ PHP versions simultaneously
<?php function e($o){return json_decode(preg_replace('/\\\u0000[*a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*\\\u0000/','',json_encode((array)$o)),1);} function cast($destination, $sourceObject) { if (is_string($destination)) { $destination = new $destination(); } $sourceReflection = new ReflectionObject($sourceObject); $destinationReflection = new ReflectionObject($destination); $sourceProperties = $sourceReflection->getProperties(); foreach ($sourceProperties as $sourceProperty) { $sourceProperty->setAccessible(true); $name = $sourceProperty->getName(); $value = $sourceProperty->getValue($sourceObject); if ($destinationReflection->hasProperty($name)) { $propDest = $destinationReflection->getProperty($name); $propDest->setAccessible(true); $propDest->setValue($destination,$value); } else { $destination->$name = $value; } } return $destination; } class Foo { public function test() { echo 'test'; } public function __call($name, $args) { echo 'overloaded call'; } } function changeMe(&$obj) { //$destClass = get_class($obj); //$obj = function(){ // echo 'hello'; //}; //$reflectionClass = new ReflectionClass($obj); //var_dump($reflectionClass); $closure = function(){}; $closure = (array) $closure; $closure['test'] = function(){echo 'hi';}; $closure = (object) $closure; //$closure = function(){}; //$obj = cast($closure, $obj); var_dump($closure); //$out = json_encode($arr); //$out = preg_replace('/\\\u0000[*a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*\\\u0000/', '', $out); //echo $out . PHP_EOL; //$newArray = json_decode($out, true); //var_dump($arr, $newArray); } $foo = new Foo(); changeMe($foo); $foo->test();

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)
8.3.60.0090.00618.56
8.3.50.0140.00621.08
8.3.40.0090.00618.84
8.3.30.0040.01119.17
8.3.20.0040.00420.18
8.3.10.0050.00321.92
8.3.00.0000.00820.52
8.2.180.0030.01016.63
8.2.170.0100.01022.96
8.2.160.0110.01119.16
8.2.150.0080.00024.18
8.2.140.0050.00324.66
8.2.130.0110.00726.16
8.2.120.0040.00419.67
8.2.110.0070.00322.25
8.2.100.0040.00717.91
8.2.90.0040.00419.38
8.2.80.0080.00018.04
8.2.70.0050.00317.50
8.2.60.0030.00518.05
8.2.50.0080.00018.07
8.2.40.0090.00018.27
8.2.30.0040.00418.14
8.2.20.0070.00017.73
8.2.10.0060.00317.78
8.2.00.0050.00519.59
8.1.280.0110.01125.92
8.1.270.0050.00322.09
8.1.260.0040.00426.35
8.1.250.0080.00028.09
8.1.240.0100.00022.56
8.1.230.0120.00019.02
8.1.220.0000.00817.80
8.1.210.0000.00818.77
8.1.200.0070.00317.35
8.1.190.0040.00417.53
8.1.180.0030.00620.53
8.1.170.0040.00418.46
8.1.160.0040.00422.18
8.1.150.0040.00418.69
8.1.140.0070.00017.51
8.1.130.0040.00417.79
8.1.120.0000.00717.50
8.1.110.0050.00317.48
8.1.100.0000.00817.52
8.1.90.0030.00517.50
8.1.80.0030.00317.46
8.1.70.0080.00017.48
8.1.60.0030.00617.61
8.1.50.0080.00017.53
8.1.40.0040.00417.51
8.1.30.0000.00717.66
8.1.20.0060.00317.51
8.1.10.0040.00417.59
8.1.00.0060.00317.49
8.0.300.0000.00718.77
8.0.290.0040.00417.04
8.0.280.0030.00318.45
8.0.270.0030.00317.19
8.0.260.0000.00616.76
8.0.250.0080.00016.82
8.0.240.0040.00416.90
8.0.230.0000.00716.87
8.0.220.0070.00016.91
8.0.210.0000.00716.73
8.0.200.0040.00416.96
8.0.190.0000.00816.90
8.0.180.0050.00216.91
8.0.170.0040.00416.83
8.0.160.0040.00416.86
8.0.150.0050.00216.87
8.0.140.0000.00716.89
8.0.130.0030.00313.38
8.0.120.0040.00416.82
8.0.110.0040.00416.93
8.0.100.0040.00416.71
8.0.90.0000.00716.89
8.0.80.0100.00616.93
8.0.70.0050.00216.87
8.0.60.0040.00416.91
8.0.50.0040.00416.69
8.0.30.0090.00917.06
8.0.20.0120.00717.40
8.0.10.0000.00817.05
8.0.00.0060.01116.80
7.4.330.0060.00015.00
7.4.320.0030.00316.57
7.4.300.0000.00716.59
7.4.290.0030.00316.64
7.4.280.0070.00016.61
7.4.270.0040.00416.60
7.4.260.0040.00416.45
7.4.250.0050.00216.41
7.4.240.0040.00316.63
7.4.230.0000.00716.71
7.4.220.0060.00916.53
7.4.210.0070.01016.59
7.4.200.0030.00316.69
7.4.190.0000.00716.73
7.4.160.0170.00316.42
7.4.150.0090.00917.40
7.4.140.0100.00817.86
7.4.130.0120.00716.53
7.4.120.0070.01016.56
7.4.110.0080.01116.42
7.4.100.0120.00616.50
7.4.90.0030.01316.44
7.4.80.0110.01419.39
7.4.70.0000.01916.39
7.4.60.0140.00416.70
7.4.50.0000.00416.40
7.4.40.0120.00222.77
7.4.30.0060.01316.64
7.4.00.0100.00314.83
7.3.330.0050.00013.15
7.3.320.0030.00313.30
7.3.310.0040.00416.33
7.3.300.0000.00816.41
7.3.290.0040.01516.38
7.3.280.0070.01116.44
7.3.270.0170.00017.40
7.3.260.0090.00916.50
7.3.250.0060.01116.41
7.3.240.0080.00816.39
7.3.230.0070.01116.48
7.3.210.0090.00916.39
7.3.200.0120.00919.39
7.3.190.0080.01516.47
7.3.180.0130.00316.53
7.3.170.0100.01016.65
7.3.160.0070.00816.35
7.3.120.0000.01414.76
7.2.330.0100.01016.79
7.2.320.0120.00616.89
7.2.310.0070.01016.68
7.2.300.0160.00316.64
7.2.290.0060.01016.82
7.2.60.0060.00916.66
7.2.00.0030.01019.44
7.1.200.0080.00415.77
7.1.100.0090.00318.00
7.1.70.0050.00217.23
7.1.60.0140.00719.82
7.1.50.0030.01016.96
7.1.00.0030.07322.40
7.0.200.0040.00416.73
7.0.140.0070.07022.02
7.0.90.0030.05019.97
7.0.80.0100.08019.86
7.0.70.0100.08319.93
7.0.60.0070.07319.96
7.0.50.0070.08720.22
7.0.40.0170.08020.13
7.0.30.0070.09020.18
7.0.20.0100.06720.05
7.0.10.0070.06020.14
7.0.00.0030.06020.00
5.6.230.0130.04320.55
5.6.220.0100.07320.52
5.6.210.0130.05020.64
5.6.200.0070.07320.98
5.6.190.0100.08021.08
5.6.180.0000.09020.97
5.6.170.0170.06721.19
5.6.160.0070.05321.12
5.6.150.0100.07321.04
5.6.140.0100.06321.02
5.6.130.0100.04721.15
5.6.120.0100.07321.18
5.6.110.0200.06721.04
5.6.100.0030.05320.96
5.6.90.0070.08021.04
5.6.80.0100.07720.46
5.6.70.0000.07720.41
5.6.60.0030.06720.38
5.6.50.0070.08320.45
5.6.40.0070.05720.51
5.6.30.0100.07320.51
5.6.20.0130.07320.42
5.6.10.0100.05720.37
5.6.00.0070.07720.45
5.5.370.0130.07320.32
5.5.360.0070.05020.50
5.5.350.0030.07320.36
5.5.340.0100.08020.82
5.5.330.0070.08020.94
5.5.320.0030.07320.81
5.5.310.0030.08020.93
5.5.300.0100.08020.77
5.5.290.0030.08720.82
5.5.280.0070.08320.92
5.5.270.0170.06020.79
5.5.260.0100.07720.77
5.5.250.0170.07020.66
5.5.240.0100.07720.29
5.5.230.0100.07320.28
5.5.220.0100.08020.32
5.5.210.0100.07720.13
5.5.200.0100.07320.13
5.5.190.0070.07720.01
5.5.180.0030.05020.16
5.5.160.0030.06720.20
5.5.150.0070.07320.16
5.5.140.0100.07020.00
5.5.130.0030.07720.13
5.5.120.0070.08020.14
5.5.110.0030.09020.14
5.5.100.0070.08020.08
5.5.90.0070.03720.16
5.5.80.0130.07320.17
5.5.70.0030.07320.11
5.5.60.0100.06320.18
5.5.50.0100.08020.07
5.5.40.0100.03720.03
5.5.30.0070.08020.17
5.5.20.0030.05020.08
5.5.10.0000.05020.13
5.5.00.0130.06319.99
5.4.450.0100.07319.18
5.4.440.0070.09319.22
5.4.430.0130.06019.45
5.4.420.0070.05319.20
5.4.410.0070.07719.40
5.4.400.0130.06719.24
5.4.390.0000.07319.23
5.4.380.0030.07719.23
5.4.370.0070.07719.05
5.4.360.0100.06719.03
5.4.350.0070.07019.23
5.4.340.0130.07719.23
5.4.320.0100.06718.91
5.4.310.0030.05319.20
5.4.300.0100.07719.03
5.4.290.0000.06319.10
5.4.280.0170.07018.94
5.4.270.0070.04719.04
5.4.260.0100.04319.18
5.4.250.0100.04019.18
5.4.240.0130.07319.14
5.4.230.0100.06318.89
5.4.220.0070.07719.09
5.4.210.0130.06019.02
5.4.200.0030.07019.11
5.4.190.0070.05719.11
5.4.180.0070.07719.11
5.4.170.0030.07719.04
5.4.160.0070.08018.83
5.4.150.0100.07319.04
5.4.140.0070.06716.36
5.4.130.0000.07016.33
5.4.120.0100.05716.45
5.4.110.0070.05016.44
5.4.100.0100.03716.56
5.4.90.0030.03716.48
5.4.80.0000.05316.54
5.4.70.0070.03316.40
5.4.60.0000.03716.37
5.4.50.0030.04716.31
5.4.40.0070.03716.48
5.4.30.0070.03716.36
5.4.20.0030.03716.30
5.4.10.0100.03016.44
5.4.00.0000.04015.85
5.3.290.0170.07014.61
5.3.280.0030.05314.59
5.3.270.0030.04714.61
5.3.260.0030.04714.71
5.3.250.0130.06314.65
5.3.240.0070.07314.75
5.3.230.0070.05714.64
5.3.220.0100.03314.68
5.3.210.0030.07714.68
5.3.200.0100.06314.64
5.3.190.0070.03714.64
5.3.180.0000.04014.68
5.3.170.0030.05714.59
5.3.160.0000.04014.61
5.3.150.0070.04014.57
5.3.140.0100.03014.70
5.3.130.0070.04014.65
5.3.120.0030.04314.71
5.3.110.0000.04014.53
5.3.100.0000.07314.20
5.3.90.0000.07014.10
5.3.80.0100.03014.10
5.3.70.0030.04714.08
5.3.60.0000.03314.14
5.3.50.0100.02713.99
5.3.40.0030.03713.87
5.3.30.0030.07313.96
5.3.20.0100.03313.78
5.3.10.0030.04313.57
5.3.00.0000.04013.72
5.2.170.0030.03711.05
5.2.160.0000.03011.16
5.2.150.0030.03011.10
5.2.140.0030.03711.04
5.2.130.0070.02711.25
5.2.120.0030.02711.22
5.2.110.0000.03011.20
5.2.100.0000.03311.14
5.2.90.0030.04711.23
5.2.80.0000.03011.18
5.2.70.0000.03311.17
5.2.60.0000.03311.21
5.2.50.0030.04310.93
5.2.40.0000.03010.90
5.2.30.0030.02711.08
5.2.20.0030.03311.00
5.2.10.0000.06711.02
5.2.00.0030.06010.69
5.1.60.0000.0239.90
5.1.50.0000.03710.00
5.1.40.0000.02310.07
5.1.30.0100.02710.48
5.1.20.0030.03310.42
5.1.10.0030.02710.17
5.1.00.0030.02010.17
5.0.50.0000.0508.68
5.0.40.0000.0208.54
5.0.30.0070.0278.30
5.0.20.0030.0178.29
5.0.10.0030.0208.29
5.0.00.0000.0278.27
4.4.90.0000.0177.13
4.4.80.0030.0177.13
4.4.70.0030.0377.13
4.4.60.0000.0137.13
4.4.50.0000.0177.13
4.4.40.0000.0237.13
4.4.30.0000.0177.13
4.4.20.0000.0137.13
4.4.10.0000.0177.13
4.4.00.0000.0237.13
4.3.110.0030.0207.13
4.3.100.0030.0137.13
4.3.90.0030.0137.13
4.3.80.0000.0337.13
4.3.70.0000.0137.13
4.3.60.0000.0177.13
4.3.50.0000.0177.13
4.3.40.0030.0377.13
4.3.30.0000.0137.13
4.3.20.0000.0177.13
4.3.10.0000.0177.13
4.3.00.0000.0207.13

preferences:
116.17 ms | 401 KiB | 5 Q