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'; } } function changeMe(&$obj) { $destClass = get_class($obj); //$obj = function(){ // echo 'hello'; //}; //$reflectionClass = new ReflectionClass($obj); //var_dump($reflectionClass); $obj = (array) $obj; $obj['bar'] = '1234'; $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.70.0110.01118.57
8.3.60.0090.00618.56
8.3.50.0080.00921.21
8.3.40.0090.00618.84
8.3.30.0070.00719.21
8.3.20.0000.00820.33
8.3.10.0040.00421.80
8.3.00.0040.00420.64
8.2.180.0160.00018.66
8.2.170.0120.00322.96
8.2.160.0060.00922.96
8.2.150.0080.00024.18
8.2.140.0040.00424.66
8.2.130.0150.00326.16
8.2.120.0040.00419.64
8.2.110.0030.00722.11
8.2.100.0060.00618.03
8.2.90.0040.00419.22
8.2.80.0000.00818.05
8.2.70.0030.00517.63
8.2.60.0080.00017.93
8.2.50.0050.00318.07
8.2.40.0030.00718.22
8.2.30.0040.00418.11
8.2.20.0040.00417.68
8.2.10.0080.00017.79
8.2.00.0040.00717.84
8.1.280.0040.01125.92
8.1.270.0000.00822.18
8.1.260.0050.00226.35
8.1.250.0000.00828.09
8.1.240.0060.00323.79
8.1.230.0040.00719.16
8.1.220.0030.00517.74
8.1.210.0050.00318.77
8.1.200.0090.00017.38
8.1.190.0040.00417.53
8.1.180.0080.00020.36
8.1.170.0050.00318.57
8.1.160.0000.00722.05
8.1.150.0040.00418.53
8.1.140.0040.00417.43
8.1.130.0030.00317.74
8.1.120.0000.00817.45
8.1.110.0040.00417.39
8.1.100.0070.00017.46
8.1.90.0000.00717.47
8.1.80.0030.00617.48
8.1.70.0050.00317.42
8.1.60.0030.00617.61
8.1.50.0000.00817.59
8.1.40.0020.00517.50
8.1.30.0000.00817.64
8.1.20.0030.00617.59
8.1.10.0000.00717.63
8.1.00.0030.00517.52
8.0.300.0060.00318.77
8.0.290.0050.00317.05
8.0.280.0040.00418.35
8.0.270.0040.00317.23
8.0.260.0060.00016.78
8.0.250.0000.00717.03
8.0.240.0000.00817.00
8.0.230.0000.00616.89
8.0.220.0030.00516.88
8.0.210.0000.00716.88
8.0.200.0000.00816.88
8.0.190.0040.00416.90
8.0.180.0070.00016.95
8.0.170.0030.00516.98
8.0.160.0000.00716.78
8.0.150.0000.00816.78
8.0.140.0070.00016.91
8.0.130.0050.00313.33
8.0.120.0050.00316.85
8.0.110.0040.00416.93
8.0.100.0000.00716.76
8.0.90.0040.00416.82
8.0.80.0080.00816.94
8.0.70.0000.00717.00
8.0.60.0000.00716.95
8.0.50.0040.00416.78
8.0.30.0110.00717.17
8.0.20.0170.00117.40
8.0.10.0070.00016.94
8.0.00.0090.01116.66
7.4.330.0000.00515.00
7.4.320.0070.00016.55
7.4.300.0000.00616.56
7.4.290.0030.00316.65
7.4.280.0030.00316.44
7.4.270.0000.00716.63
7.4.260.0030.00316.42
7.4.250.0000.00816.44
7.4.240.0000.00716.56
7.4.230.0000.00716.74
7.4.220.0030.01216.71
7.4.210.0090.00816.63
7.4.200.0050.00316.64
7.4.190.0050.00216.75
7.4.160.0120.00616.63
7.4.150.0110.00617.40
7.4.140.0140.00917.86
7.4.130.0120.00616.49
7.4.120.0090.00916.67
7.4.110.0140.00416.49
7.4.100.0140.00716.61
7.4.90.0070.01016.52
7.4.80.0110.01119.39
7.4.70.0070.01316.71
7.4.60.0140.00416.72
7.4.50.0040.00016.47
7.4.40.0090.00622.77
7.4.30.0100.00716.54
7.4.00.0030.01215.17
7.3.330.0050.00013.41
7.3.320.0060.00013.50
7.3.310.0080.00016.30
7.3.300.0040.00416.35
7.3.290.0130.00316.47
7.3.280.0090.00716.40
7.3.270.0080.01017.40
7.3.260.0090.01216.57
7.3.250.0130.00516.53
7.3.240.0080.00816.35
7.3.230.0040.01316.53
7.3.210.0110.00716.42
7.3.200.0060.01319.39
7.3.190.0100.00716.48
7.3.180.0030.01316.66
7.3.170.0130.00716.46
7.3.160.0120.00316.56
7.3.120.0060.00914.94
7.3.10.0110.00016.50
7.3.00.0060.00816.49
7.2.330.0150.00316.76
7.2.320.0070.01016.77
7.2.310.0130.00316.48
7.2.300.0090.01116.57
7.2.290.0060.01016.82
7.2.130.0050.00916.93
7.2.120.0060.01216.71
7.2.110.0020.00916.90
7.2.100.0100.00516.71
7.2.90.0110.00916.79
7.2.80.0140.00716.83
7.2.70.0130.00616.78
7.2.60.0060.01016.80
7.2.50.0070.00716.86
7.2.40.0120.00416.79
7.2.30.0080.00717.06
7.2.20.0060.01016.47
7.2.10.0080.00716.69
7.2.00.0030.01017.70
7.1.250.0080.00615.68
7.1.200.0000.01115.56
7.1.100.0080.00318.16
7.1.70.0050.01017.28
7.1.60.0030.01519.82
7.1.50.0090.00916.93
7.1.00.0070.07322.30
7.0.200.0070.00316.77
7.0.140.0000.07722.08
7.0.90.0300.07319.94
7.0.80.0070.04320.18
7.0.70.0430.07719.94
7.0.60.0330.05019.98
7.0.50.0600.07720.33
7.0.40.0070.05020.19
7.0.30.0100.07020.10
7.0.20.0070.06020.08
7.0.10.0030.08020.13
7.0.00.0070.05020.07
5.6.280.0070.07021.04
5.6.240.0100.07720.69
5.6.230.0100.05020.55
5.6.220.0000.08320.63
5.6.210.0070.04020.75
5.6.200.0030.08321.05
5.6.190.0070.04721.18
5.6.180.0230.06021.11
5.6.170.0130.05720.97
5.6.160.0030.08321.06
5.6.150.0030.06721.18
5.6.140.0130.04721.17
5.6.130.0070.08021.04
5.6.120.0070.08720.95
5.6.110.0100.05721.02
5.6.100.0270.05021.02
5.6.90.0030.07321.02
5.6.80.0070.04020.45
5.6.70.0070.08320.34
5.6.60.0030.04320.46
5.6.50.0030.04320.50
5.6.40.0030.07020.41
5.6.30.0130.05320.46
5.6.20.0030.08320.38
5.6.10.0070.06320.40
5.6.00.0130.07020.48
5.5.380.0030.03720.36
5.5.370.0100.07020.55
5.5.360.0030.05020.35
5.5.350.0100.06320.45
5.5.340.0100.07320.91
5.5.330.0100.05020.77
5.5.320.0170.06720.84
5.5.310.0000.05320.90
5.5.300.0100.06720.79
5.5.290.0100.07720.84
5.5.280.0100.04320.65
5.5.270.0000.05320.83
5.5.260.0170.06320.89
5.5.250.0100.07320.59
5.5.240.0100.06020.32
5.5.230.0030.05020.27
5.5.220.0070.04320.32
5.5.210.0070.04020.19
5.5.200.0100.07720.17
5.5.190.0270.06020.24
5.5.180.0100.07720.20
5.5.160.0100.07720.12
5.5.150.0070.07720.23
5.5.140.0130.07020.19
5.5.130.0070.07720.19
5.5.120.0170.06720.28
5.5.110.0030.08020.12
5.5.100.0070.07320.13
5.5.90.0100.04320.14
5.5.80.0000.07319.98
5.5.70.0030.05320.06
5.5.60.0030.06320.15
5.5.50.0200.06720.07
5.5.40.0070.08020.07
5.5.30.0100.04020.11
5.5.20.0070.07720.09
5.5.10.0130.06720.08
5.5.00.0000.05020.05
5.4.450.0030.08019.33
5.4.440.0100.07019.42
5.4.430.0030.06319.53
5.4.420.0070.07019.53
5.4.410.0100.03719.24
5.4.400.0030.07719.03
5.4.390.0200.06319.09
5.4.380.0070.06318.86
5.4.370.0030.08019.21
5.4.360.0100.07318.85
5.4.350.0070.04719.16
5.4.340.0130.07019.03
5.4.320.0030.05718.90
5.4.310.0070.07719.03
5.4.300.0070.07719.25
5.4.290.0070.06018.85
5.4.280.0070.08019.04
5.4.270.0000.05019.18
5.4.260.0100.04019.12
5.4.250.0070.04319.13
5.4.240.0100.05319.18
5.4.230.0070.07018.84
5.4.220.0130.07019.09
5.4.210.0000.05719.11
5.4.200.0070.04319.03
5.4.190.0070.04319.13
5.4.180.0130.06719.13
5.4.170.0070.08019.08
5.4.160.0070.08019.12
5.4.150.0130.07019.05
5.4.140.0070.07316.47
5.4.130.0130.07016.41
5.4.120.0070.04716.34
5.4.110.0100.07016.56
5.4.100.0030.05316.32
5.4.90.0100.04016.48
5.4.80.0130.06016.47
5.4.70.0070.07716.50
5.4.60.0130.05316.25
5.4.50.0130.06716.47
5.4.40.0000.08316.41
5.4.30.0100.07016.40
5.4.20.0170.06316.33
5.4.10.0000.06316.38
5.4.00.0100.06715.84
5.3.290.0100.07014.64
5.3.280.0170.06014.74
5.3.270.0070.05314.64
5.3.260.0070.07714.60
5.3.250.0100.07014.59
5.3.240.0070.07314.55
5.3.230.0100.03714.64
5.3.220.0130.04014.51
5.3.210.0030.04714.66
5.3.200.0100.06714.55
5.3.190.0070.04714.68
5.3.180.0070.04014.57
5.3.170.0070.07714.63
5.3.160.0030.05014.56
5.3.150.0030.07014.62
5.3.140.0100.08014.71
5.3.130.0100.07014.51
5.3.120.0030.07014.65
5.3.110.0130.06714.56
5.3.100.0030.07714.14
5.3.90.0070.06014.09
5.3.80.0130.06713.96
5.3.70.0100.07714.18
5.3.60.0070.07713.94
5.3.50.0130.03313.86
5.3.40.0030.08014.10
5.3.30.0070.06713.91
5.3.20.0000.07713.69
5.3.10.0000.07713.59
5.3.00.0070.06713.57
5.2.170.0100.05711.07
5.2.160.0070.06011.09
5.2.150.0070.04311.26
5.2.140.0030.06311.09
5.2.130.0130.05311.00
5.2.120.0000.05011.20
5.2.110.0100.05311.02
5.2.100.0100.05311.02
5.2.90.0070.06311.02
5.2.80.0100.05711.12
5.2.70.0100.06311.22
5.2.60.0100.05311.13
5.2.50.0000.06710.93
5.2.40.0100.04311.15
5.2.30.0070.04011.08
5.2.20.0070.05310.92
5.2.10.0000.04310.89
5.2.00.0000.05710.66
5.1.60.0000.03710.04
5.1.50.0100.03310.04
5.1.40.0030.05010.05
5.1.30.0030.06010.27
5.1.20.0030.03310.38
5.1.10.0000.06010.08
5.1.00.0000.02710.05
5.0.50.0000.0338.55
5.0.40.0000.0208.28
5.0.30.0130.0308.23
5.0.20.0030.0278.06
5.0.10.0000.0208.20
5.0.00.0030.0278.17
4.4.90.0070.0337.45
4.4.80.0030.0337.45
4.4.70.0000.0337.45
4.4.60.0000.0337.45
4.4.50.0070.0237.45
4.4.40.0030.0277.45
4.4.30.0070.0337.45
4.4.20.0000.0237.45
4.4.10.0000.0177.45
4.4.00.0000.0277.45
4.3.110.0000.0177.45
4.3.100.0030.0137.45
4.3.90.0000.0277.45
4.3.80.0000.0307.45
4.3.70.0000.0177.45
4.3.60.0000.0307.45
4.3.50.0000.0137.45
4.3.40.0000.0337.45
4.3.30.0000.0137.45
4.3.20.0030.0237.45
4.3.10.0030.0137.45
4.3.00.0000.0137.45

preferences:
56.5 ms | 401 KiB | 5 Q