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); $obj = (array) $obj; $obj['test'] = function(){echo 'hi';}; $obj = (object) $obj; //$closure = function(){}; //$obj = cast($closure, $obj); var_dump($obj); //$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.0130.00718.38
8.3.50.0170.00521.21
8.3.40.0090.00919.01
8.3.30.0150.00019.23
8.3.20.0040.00420.16
8.3.10.0050.00322.17
8.3.00.0000.00822.52
8.2.180.0000.01516.63
8.2.170.0090.00622.96
8.2.160.0140.00319.16
8.2.150.0050.00324.18
8.2.140.0090.00024.66
8.2.130.0140.00426.16
8.2.120.0050.00319.79
8.2.110.0110.00022.01
8.2.100.0070.00419.39
8.2.90.0040.00419.29
8.2.80.0040.00417.97
8.2.70.0030.00617.75
8.2.60.0040.00418.05
8.2.50.0040.00418.07
8.2.40.0000.00918.25
8.2.30.0030.00518.14
8.2.20.0050.00217.91
8.2.10.0040.00417.70
8.2.00.0100.00017.74
8.1.280.0130.00325.92
8.1.270.0030.00622.06
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0060.00323.79
8.1.230.0080.00319.12
8.1.220.0030.00617.79
8.1.210.0040.00418.77
8.1.200.0070.00317.47
8.1.190.0050.00317.53
8.1.180.0080.00020.51
8.1.170.0050.00318.65
8.1.160.0070.00022.18
8.1.150.0040.00418.68
8.1.140.0000.00817.42
8.1.130.0030.00317.90
8.1.120.0030.00417.44
8.1.110.0000.00717.42
8.1.100.0070.00017.37
8.1.90.0040.00417.47
8.1.80.0040.00417.47
8.1.70.0000.00717.46
8.1.60.0080.00017.59
8.1.50.0000.00817.51
8.1.40.0000.00717.43
8.1.30.0030.00617.54
8.1.20.0080.00017.65
8.1.10.0030.00517.60
8.1.00.0060.00317.36
8.0.300.0040.00418.77
8.0.290.0040.00417.05
8.0.280.0060.00318.38
8.0.270.0000.00717.09
8.0.260.0070.00016.71
8.0.250.0000.00716.87
8.0.240.0040.00417.02
8.0.230.0070.00016.81
8.0.220.0000.00716.93
8.0.210.0070.00016.77
8.0.200.0000.00717.03
8.0.190.0080.00017.00
8.0.180.0050.00316.92
8.0.170.0040.00417.02
8.0.160.0000.00816.90
8.0.150.0000.00716.84
8.0.140.0070.00016.98
8.0.130.0060.00313.40
8.0.120.0040.00416.85
8.0.110.0030.00517.02
8.0.100.0040.00416.81
8.0.90.0040.00417.07
8.0.80.0060.00916.96
8.0.70.0050.00217.04
8.0.60.0040.00416.84
8.0.50.0070.00017.08
8.0.30.0050.01417.24
8.0.20.0100.01217.41
8.0.10.0040.00416.93
8.0.00.0080.01116.91
7.4.330.0000.00415.08
7.4.320.0000.00616.52
7.4.300.0030.00316.64
7.4.290.0000.00816.60
7.4.280.0000.00716.37
7.4.270.0000.00816.56
7.4.260.0000.00716.60
7.4.250.0080.00016.61
7.4.240.0040.00416.58
7.4.230.0000.00716.64
7.4.220.0060.00916.52
7.4.210.0050.01316.56
7.4.200.0040.00416.41
7.4.190.0080.00016.60
7.4.160.0130.00316.45
7.4.150.0070.01317.40
7.4.140.0100.01017.86
7.4.130.0060.01316.49
7.4.120.0100.00916.59
7.4.110.0080.01216.55
7.4.100.0140.00616.49
7.4.90.0140.00416.55
7.4.80.0060.01819.39
7.4.70.0150.00616.56
7.4.60.0130.00316.55
7.4.50.0030.00616.36
7.4.40.0040.01122.77
7.4.30.0060.01916.61
7.4.00.0070.01015.24
7.3.330.0050.00013.44
7.3.320.0030.00313.43
7.3.310.0030.00316.53
7.3.300.0070.00016.43
7.3.290.0100.01016.45
7.3.280.0110.00716.41
7.3.270.0090.00617.40
7.3.260.0100.00716.30
7.3.250.0110.00516.53
7.3.240.0070.01016.61
7.3.230.0170.00016.39
7.3.210.0060.01216.60
7.3.200.0110.01119.39
7.3.190.0090.01316.35
7.3.180.0110.00516.45
7.3.170.0100.01316.63
7.3.160.0090.00616.51
7.3.120.0070.00714.75
7.2.330.0070.01016.77
7.2.320.0080.00816.55
7.2.310.0070.01016.73
7.2.300.0080.00816.74
7.2.290.0070.01316.81
7.2.80.0100.00316.79
7.2.60.0070.00717.04
7.2.00.0000.01319.66
7.1.200.0030.01015.84
7.1.70.0000.01117.02
7.1.60.0070.00317.38
7.1.50.0200.01334.80
7.1.00.0000.06322.42
7.0.200.0030.01316.92
7.0.140.0030.07321.93
7.0.90.0070.08020.07
7.0.80.0200.07019.91
7.0.70.0130.07019.96
7.0.60.0070.05720.02
7.0.50.0030.08720.34
7.0.40.0070.08320.19
7.0.30.0070.08320.07
7.0.20.0070.06720.10
7.0.10.0070.06720.05
7.0.00.0100.08020.04
5.6.280.0070.08721.17
5.6.240.0170.07020.65
5.6.230.0100.08020.73
5.6.220.0130.07320.51
5.6.210.0070.08020.60
5.6.200.0170.04021.19
5.6.190.0100.07721.09
5.6.180.0030.08721.05
5.6.170.0100.08321.12
5.6.160.0100.08021.06
5.6.150.0070.05321.05
5.6.140.0130.08021.02
5.6.130.0100.08720.97
5.6.120.0000.08320.96
5.6.110.0070.04721.11
5.6.100.0100.07721.14
5.6.90.0100.08720.95
5.6.80.0000.05720.48
5.6.70.0130.06320.40
5.6.60.0100.07720.52
5.6.50.0070.07720.42
5.6.40.0130.07020.39
5.6.30.0200.03320.46
5.6.20.0100.07320.44
5.6.10.0100.07720.39
5.6.00.0130.07720.41
5.5.380.0100.08320.38
5.5.370.0170.06720.37
5.5.360.0030.05320.42
5.5.350.0100.07720.35
5.5.340.0030.05020.85
5.5.330.0130.04320.82
5.5.320.0130.06720.89
5.5.310.0030.08320.79
5.5.300.0100.07720.87
5.5.290.0170.07720.81
5.5.280.0200.05020.94
5.5.270.0100.04720.87
5.5.260.0000.05020.78
5.5.250.0130.07320.70
5.5.240.0030.04720.29
5.5.230.0130.08020.20
5.5.220.0100.08320.28
5.5.210.0030.08020.23
5.5.200.0100.07720.16
5.5.190.0030.08020.10
5.5.180.0100.07720.01
5.5.160.0070.05320.01
5.5.150.0030.06320.00
5.5.140.0170.07020.12
5.5.130.0100.05320.20
5.5.120.0070.07320.29
5.5.110.0030.08720.14
5.5.100.0030.05020.09
5.5.90.0030.04320.09
5.5.80.0070.08020.19
5.5.70.0100.06720.05
5.5.60.0070.05320.10
5.5.50.0200.06320.14
5.5.40.0130.07019.95
5.5.30.0070.06320.01
5.5.20.0030.06320.07
5.5.10.0070.03720.07
5.5.00.0030.08019.98
5.4.450.0170.06719.21
5.4.440.0070.05319.23
5.4.430.0030.07719.37
5.4.420.0000.07719.22
5.4.410.0130.03719.07
5.4.400.0130.07719.25
5.4.390.0030.06019.16
5.4.380.0030.04319.18
5.4.370.0100.07318.90
5.4.360.0070.07719.13
5.4.350.0070.07319.03
5.4.340.0070.08018.91
5.4.320.0030.04019.05
5.4.310.0100.03719.23
5.4.300.0030.06719.12
5.4.290.0030.07719.06
5.4.280.0130.04019.12
5.4.270.0030.06019.13
5.4.260.0100.06719.21
5.4.250.0030.04318.84
5.4.240.0230.06718.94
5.4.230.0000.08019.17
5.4.220.0030.06019.03
5.4.210.0130.06018.94
5.4.200.0030.05319.11
5.4.190.0130.05019.00
5.4.180.0100.07719.02
5.4.170.0030.07319.03
5.4.160.0100.04019.16
5.4.150.0070.03719.16
5.4.140.0030.07716.42
5.4.130.0030.06016.34
5.4.120.0070.04316.46
5.4.110.0070.03716.41
5.4.100.0070.05016.32
5.4.90.0100.07016.52
5.4.80.0030.08016.43
5.4.70.0130.06716.39
5.4.60.0130.06016.40
5.4.50.0070.07016.25
5.4.40.0070.05316.41
5.4.30.0130.06316.33
5.4.20.0030.05316.50
5.4.10.0000.07316.45
5.4.00.0030.05315.73
5.3.290.0070.04714.77
5.3.280.0070.05714.71
5.3.270.0100.06314.59
5.3.260.0200.05314.65
5.3.250.0170.02714.57
5.3.240.0170.06314.74
5.3.230.0100.04014.62
5.3.220.0170.03314.51
5.3.210.0000.08014.61
5.3.200.0070.08014.59
5.3.190.0030.08014.55
5.3.180.0100.04014.64
5.3.170.0100.07014.56
5.3.160.0100.07314.61
5.3.150.0130.06714.51
5.3.140.0070.07314.66
5.3.130.0130.07014.59
5.3.120.0100.04314.63
5.3.110.0030.04714.69
5.3.100.0100.03714.12
5.3.90.0100.07014.10
5.3.80.0100.07013.96
5.3.70.0070.08014.09
5.3.60.0130.06714.00
5.3.50.0070.07013.89
5.3.40.0100.07013.89
5.3.30.0130.04314.03
5.3.20.0100.05713.64
5.3.10.0070.07313.76
5.3.00.0130.03713.72
5.2.170.0070.05011.29
5.2.160.0030.04011.28
5.2.150.0100.05711.07
5.2.140.0030.06311.04
5.2.130.0070.04711.12
5.2.120.0000.05710.98
5.2.110.0130.02711.18
5.2.100.0070.06010.97
5.2.90.0070.06310.97
5.2.80.0100.05311.13
5.2.70.0000.04311.23
5.2.60.0170.03711.06
5.2.50.0100.05011.09
5.2.40.0070.05311.03
5.2.30.0030.06311.00
5.2.20.0100.03310.89
5.2.10.0030.06710.78
5.2.00.0070.05710.73
5.1.60.0100.04710.08
5.1.50.0070.02710.01
5.1.40.0030.05710.02
5.1.30.0100.04710.22
5.1.20.0030.06010.48
5.1.10.0000.06310.09
5.1.00.0100.0409.97
5.0.50.0070.0338.56
5.0.40.0030.0238.45
5.0.30.0000.0338.14
5.0.20.0030.0378.07
5.0.10.0030.0308.21
5.0.00.0030.0338.25
4.4.90.0030.0277.12
4.4.80.0070.0307.12
4.4.70.0070.0207.12
4.4.60.0000.0377.12
4.4.50.0030.0307.12
4.4.40.0030.0537.12
4.4.30.0000.0407.12
4.4.20.0070.0307.12
4.4.10.0100.0277.12
4.4.00.0030.0407.12
4.3.110.0000.0177.12
4.3.100.0070.0277.12
4.3.90.0030.0177.12
4.3.80.0000.0307.12
4.3.70.0000.0207.12
4.3.60.0030.0207.12
4.3.50.0000.0377.12
4.3.40.0030.0507.12
4.3.30.0070.0337.12
4.3.20.0030.0307.12
4.3.10.0000.0407.12
4.3.00.0000.0307.12

preferences:
46.98 ms | 400 KiB | 5 Q