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; $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.0120.00918.43
8.3.60.0140.00718.43
8.3.50.0150.00621.27
8.3.40.0180.00418.93
8.3.30.0080.00819.22
8.3.20.0040.00420.20
8.3.10.0000.00821.92
8.3.00.0030.00522.34
8.2.190.0070.01017.00
8.2.180.0080.00816.88
8.2.170.0070.00722.96
8.2.160.0060.00819.21
8.2.150.0050.00324.18
8.2.140.0080.00024.66
8.2.130.0110.00726.16
8.2.120.0000.00819.54
8.2.110.0100.00022.11
8.2.100.0090.00319.33
8.2.90.0040.00419.03
8.2.80.0040.00417.97
8.2.70.0000.00817.25
8.2.60.0040.00418.04
8.2.50.0030.00618.07
8.2.40.0040.00718.10
8.2.30.0070.00018.11
8.2.20.0080.00017.87
8.2.10.0060.00317.96
8.2.00.0090.00317.78
8.1.280.0110.00325.92
8.1.270.0040.00422.20
8.1.260.0060.00326.35
8.1.250.0000.00828.09
8.1.240.0060.00323.86
8.1.230.0090.00318.97
8.1.220.0050.00317.74
8.1.210.0050.00318.77
8.1.200.0000.01117.35
8.1.190.0040.00417.41
8.1.180.0080.00020.48
8.1.170.0040.00418.51
8.1.160.0040.00422.10
8.1.150.0080.00018.69
8.1.140.0000.00717.42
8.1.130.0030.00317.79
8.1.120.0070.00017.48
8.1.110.0040.00417.49
8.1.100.0040.00417.40
8.1.90.0060.00317.29
8.1.80.0050.00217.41
8.1.70.0040.00417.42
8.1.60.0060.00317.62
8.1.50.0070.00017.63
8.1.40.0000.00817.58
8.1.30.0050.00317.70
8.1.20.0000.00817.75
8.1.10.0080.00017.58
8.1.00.0040.00417.43
8.0.300.0000.00818.77
8.0.290.0060.00317.18
8.0.280.0000.00818.30
8.0.270.0040.00417.31
8.0.260.0030.00316.90
8.0.250.0030.00316.98
8.0.240.0030.00616.85
8.0.230.0000.00717.00
8.0.220.0070.00016.97
8.0.210.0030.00316.95
8.0.200.0000.00617.07
8.0.190.0000.00816.96
8.0.180.0040.00417.00
8.0.170.0060.00316.99
8.0.160.0040.00416.87
8.0.150.0000.00716.93
8.0.140.0040.00416.84
8.0.130.0030.00413.41
8.0.120.0000.00716.94
8.0.110.0080.00016.96
8.0.100.0070.00017.01
8.0.90.0040.00417.01
8.0.80.0100.01016.83
8.0.70.0000.00716.84
8.0.60.0080.00016.81
8.0.50.0030.00516.81
8.0.30.0080.01017.18
8.0.20.0080.01017.44
8.0.10.0050.00317.13
8.0.00.0050.01216.80
7.4.330.0020.00215.05
7.4.320.0030.00316.60
7.4.300.0000.00616.70
7.4.290.0000.00716.64
7.4.280.0000.00716.59
7.4.270.0000.00716.49
7.4.260.0000.00716.53
7.4.250.0050.00216.50
7.4.240.0030.00316.52
7.4.230.0030.00316.54
7.4.220.0090.00616.42
7.4.210.0050.01216.62
7.4.200.0030.00316.40
7.4.190.0040.00416.75
7.4.160.0120.00416.62
7.4.150.0140.00417.40
7.4.140.0120.00817.86
7.4.130.0130.00616.62
7.4.120.0090.00916.67
7.4.110.0000.01716.66
7.4.100.0170.00616.48
7.4.90.0070.01116.58
7.4.80.0100.00919.39
7.4.70.0100.00716.46
7.4.60.0100.00716.73
7.4.50.0000.00916.76
7.4.40.0070.00722.77
7.4.30.0040.01216.56
7.4.10.0070.01015.30
7.4.00.0100.00715.07
7.3.330.0020.00213.28
7.3.320.0000.00513.36
7.3.310.0070.00016.45
7.3.300.0070.00016.41
7.3.290.0070.00716.41
7.3.280.0040.01216.42
7.3.270.0030.01417.40
7.3.260.0140.00616.57
7.3.250.0090.00816.41
7.3.240.0150.00616.34
7.3.230.0170.00616.41
7.3.210.0040.01416.38
7.3.200.0110.00916.60
7.3.190.0030.01316.24
7.3.180.0030.01216.46
7.3.170.0090.01216.47
7.3.160.0110.00416.34
7.3.130.0070.01115.30
7.3.120.0100.00715.00
7.3.110.0050.01115.07
7.3.100.0030.01214.96
7.3.90.0090.00314.96
7.3.80.0080.00814.93
7.3.70.0060.00615.15
7.3.60.0110.00415.08
7.3.50.0090.00415.09
7.3.40.0100.00514.98
7.3.30.0040.01115.03
7.3.20.0080.00516.72
7.3.10.0040.01116.50
7.3.00.0040.00916.49
7.2.330.0090.00916.82
7.2.320.0100.00716.42
7.2.310.0060.01216.48
7.2.300.0150.00516.73
7.2.290.0070.01316.71
7.2.260.0070.01115.30
7.2.250.0090.00515.12
7.2.240.0050.01115.26
7.2.230.0110.00415.10
7.2.220.0110.00615.13
7.2.210.0030.01115.10
7.2.200.0000.01115.08
7.2.190.0060.00915.00
7.2.180.0030.01215.14
7.2.170.0030.01315.15
7.2.160.0060.00715.15
7.2.150.0070.00716.95
7.2.140.0070.00516.91
7.2.130.0110.00616.85
7.2.120.0090.00716.70
7.2.110.0100.00616.77
7.2.100.0090.00816.82
7.2.90.0090.00716.59
7.2.80.0090.01116.83
7.2.70.0120.00316.79
7.2.60.0080.00816.57
7.2.50.0060.00716.70
7.2.40.0050.01416.79
7.2.30.0100.00716.90
7.2.20.0070.00916.72
7.2.10.0080.00916.63
7.2.00.0080.00917.38
7.1.330.0060.00815.78
7.1.320.0120.00715.66
7.1.310.0060.00815.74
7.1.300.0070.00715.88
7.1.290.0040.00415.77
7.1.280.0090.00715.91
7.1.270.0070.00615.73
7.1.260.0060.00615.88
7.1.250.0050.00715.84
7.1.240.0100.00315.70
7.1.230.0070.00715.90
7.1.220.0090.00415.65
7.1.210.0050.00715.67
7.1.200.0030.01115.84
7.1.190.0060.00915.88
7.1.180.0080.00715.81
7.1.170.0040.00915.89
7.1.160.0020.01315.79
7.1.150.0070.00715.94
7.1.140.0050.00915.97
7.1.130.0050.01015.76
7.1.120.0050.00515.82
7.1.110.0040.00515.78
7.1.100.0070.00416.65
7.1.90.0070.00615.90
7.1.80.0020.01415.73
7.1.70.0050.00616.26
7.1.60.0100.00717.11
7.1.50.0060.00916.25
7.1.40.0070.00515.82
7.1.30.0040.01015.67
7.1.20.0110.00415.75
7.1.10.0030.01015.81
7.1.00.0030.01818.03
7.0.330.0030.00815.49
7.0.320.0060.00615.43
7.0.310.0070.00815.29
7.0.300.0020.01015.46
7.0.290.0000.01615.38
7.0.280.0050.00915.53
7.0.270.0000.01115.39
7.0.260.0050.00515.45
7.0.250.0020.00615.49
7.0.240.0040.00915.57
7.0.230.0070.00515.31
7.0.220.0060.00815.39
7.0.210.0000.01315.58
7.0.200.0040.00615.77
7.0.190.0040.01115.43
7.0.180.0040.00615.39
7.0.170.0080.00515.50
7.0.160.0040.00915.33
7.0.150.0080.00315.49
7.0.140.0030.03217.65
7.0.130.0050.01015.49
7.0.120.0070.00715.40
7.0.110.0020.00815.47
7.0.100.0080.00615.36
7.0.90.0260.03016.96
7.0.80.0230.03216.87
7.0.70.0090.02916.96
7.0.60.0080.02316.81
7.0.50.0100.02917.05
7.0.40.0060.03416.17
7.0.30.0060.02416.33
7.0.20.0030.03616.24
7.0.10.0040.02416.25
7.0.00.0060.03616.33
5.6.400.0040.01314.91
5.6.390.0060.00814.75
5.6.380.0060.00914.90
5.6.370.0060.00415.05
5.6.360.0060.00614.92
5.6.350.0050.00814.77
5.6.340.0050.00715.01
5.6.330.0020.00914.92
5.6.320.0060.00714.91
5.6.310.0030.00814.77
5.6.300.0060.00714.85
5.6.290.0050.01215.05
5.6.280.0040.03116.99
5.6.270.0110.00314.79
5.6.260.0070.00514.87
5.6.250.0070.00814.86
5.6.240.0050.02916.69
5.6.230.0090.03016.83
5.6.220.0100.02616.78
5.6.210.0110.02416.82
5.6.200.0110.02316.82
5.6.190.0080.03316.93
5.6.180.0040.02916.91
5.6.170.0020.02616.96
5.6.160.0080.02116.94
5.6.150.0060.02316.96
5.6.140.0070.02216.98
5.6.130.0150.02316.91
5.6.120.0050.02217.00
5.6.110.0060.03316.92
5.6.100.0060.03016.89
5.6.90.0080.03216.93
5.6.80.0040.03116.65
5.6.70.0070.03116.73
5.6.60.0030.03416.62
5.6.50.0050.02716.67
5.6.40.0060.03316.68
5.6.30.0070.03016.69
5.6.20.0090.02616.70
5.6.10.0040.03416.74
5.6.00.0080.02916.73
5.5.380.0020.02116.75
5.5.370.0060.03116.73
5.5.360.0090.02816.69
5.5.350.0070.02516.80
5.5.340.0070.03216.95
5.5.330.0060.03016.84
5.5.320.0040.03116.79
5.5.310.0100.01616.76
5.5.300.0080.02316.83
5.5.290.0060.03216.86
5.5.280.0040.03316.84
5.5.270.0060.02416.83
5.5.260.0070.03416.81
5.5.250.0060.02216.71
5.5.240.0080.03016.71
5.5.230.0060.03116.63
5.5.220.0090.02616.56
5.5.210.0060.03116.68
5.5.200.0040.03516.67
5.5.190.0120.02516.47
5.5.180.0040.03316.67
5.5.170.0060.00714.75
5.5.160.0100.02816.46
5.5.150.0050.02716.59
5.5.140.0070.02716.54
5.5.130.0060.03216.65
5.5.120.0090.02716.69
5.5.110.0070.01916.70
5.5.100.0040.03116.56
5.5.90.0080.03216.63
5.5.80.0070.02716.58
5.5.70.0100.01416.63
5.5.60.0080.01716.58
5.5.50.0090.02016.52
5.5.40.0060.01816.59
5.5.30.0100.02716.57
5.5.20.0020.03216.52
5.5.10.0060.03216.62
5.5.00.0070.02016.50
5.4.450.0010.03315.34
5.4.440.0040.02915.30
5.4.430.0060.02015.31
5.4.420.0020.03015.29
5.4.410.0080.01515.21
5.4.400.0070.02415.27
5.4.390.0050.02715.23
5.4.380.0060.01515.24
5.4.370.0030.01715.25
5.4.360.0070.02615.24
5.4.350.0030.02715.16
5.4.340.0070.03115.19
5.4.330.0030.00713.26
5.4.320.0020.02115.21
5.4.310.0090.01815.18
5.4.300.0060.02815.25
5.4.290.0050.01915.21
5.4.280.0030.02915.13
5.4.270.0070.02615.19
5.4.260.0050.02715.22
5.4.250.0070.03115.23
5.4.240.0090.02115.29
5.4.230.0070.01915.23
5.4.220.0070.02715.20
5.4.210.0020.02415.22
5.4.200.0050.02515.18
5.4.190.0060.01615.16
5.4.180.0090.02315.24
5.4.170.0040.01915.13
5.4.160.0090.02715.18
5.4.150.0020.02215.22
5.4.140.0020.01914.37
5.4.130.0050.01614.29
5.4.120.0090.02414.34
5.4.110.0040.02914.35
5.4.100.0040.02114.36
5.4.90.0090.02514.31
5.4.80.0010.03114.31
5.4.70.0060.02814.30
5.4.60.0010.02214.29
5.4.50.0070.02314.26
5.4.40.0050.02114.34
5.4.30.0050.02914.28
5.4.20.0060.02914.33
5.4.10.0060.02914.32
5.4.00.0020.02514.14
5.3.290.0030.03213.75
5.3.280.0050.03113.69
5.3.270.0040.03113.75
5.3.260.0080.02613.69
5.3.250.0050.02413.70
5.3.240.0040.02013.73
5.3.230.0020.03413.73
5.3.220.0040.03013.71
5.3.210.0080.02713.75
5.3.200.0050.02613.71
5.3.190.0040.03113.68
5.3.180.0050.02513.72
5.3.170.0030.03113.70
5.3.160.0020.02313.68
5.3.150.0050.02913.74
5.3.140.0090.02413.68
5.3.130.0030.02413.72
5.3.120.0080.02013.70
5.3.110.0030.02213.70
5.3.100.0030.01713.53
5.3.90.0070.01413.51
5.3.80.0050.02313.54
5.3.70.0060.01713.48
5.3.60.0060.01713.52
5.3.50.0010.02013.49
5.3.40.0080.01413.46
5.3.30.0050.01413.46
5.3.20.0040.01913.38
5.3.10.0040.02513.40
5.3.00.0010.02013.37
5.2.170.0100.03011.24
5.2.160.0030.06311.24
5.2.150.0000.03311.28
5.2.140.0070.06011.09
5.2.130.0000.05711.12
5.2.120.0000.04311.17
5.2.110.0030.03711.03
5.2.100.0070.03711.10
5.2.90.0030.05011.17
5.2.80.0000.04011.16
5.2.70.0030.06311.09
5.2.60.0030.05011.08
5.2.50.0070.06311.18
5.2.40.0000.07011.11
5.2.30.0030.06010.98
5.2.20.0030.06010.99
5.2.10.0100.05310.88
5.2.00.0030.06010.73
5.1.60.0070.04710.08
5.1.50.0070.05310.06
5.1.40.0030.05010.00
5.1.30.0100.05010.42
5.1.20.0070.03710.44
5.1.10.0070.02310.15
5.1.00.0030.03310.17
5.0.50.0070.0339.79
5.0.40.0100.0279.79
5.0.30.0000.0439.79
5.0.20.0000.0409.79
5.0.10.0000.0239.79
5.0.00.0030.0539.79
4.4.90.0030.0279.79
4.4.80.0000.0379.79
4.4.70.0000.0309.79
4.4.60.0000.0279.79
4.4.50.0070.0279.79
4.4.40.0000.0409.79
4.4.30.0000.0409.79
4.4.20.0000.0379.79
4.4.10.0000.0379.79
4.4.00.0030.0479.79
4.3.110.0100.0109.79
4.3.100.0000.0379.79
4.3.90.0000.0279.79
4.3.80.0030.0409.79
4.3.70.0000.0209.79
4.3.60.0000.0179.79
4.3.50.0030.0179.79
4.3.40.0000.0509.79
4.3.30.0000.0339.79
4.3.20.0000.0379.79
4.3.10.0000.0309.79
4.3.00.0030.0209.79

preferences:
46.09 ms | 401 KiB | 5 Q