3v4l.org

run code in 300+ PHP versions simultaneously
<?php function check_array($arr = false, $index = false){ if(is_array($arr)){ if(is_numeric($index)||is_string($index)){ if(array_key_exists($index, $arr)){ return $arr[$index]; } } } return false; } $types = array( // boolean true, false, // sig int -2, -1, 0, 1, 2, // float 1.111, // string "Punc,tua!ti'o\"n", // array array(), array(0,1,2), array(1 => 0, 1, 2), // object new stdClass, // NULL NULL ); // print heading echo "array\tindex\tresult\n"; $run_once = false; foreach($types as $type){ $line = ''; $myArr = $type; foreach($types as $type){ $myIndex = $type; $line .= gettype($myArr); if(is_scalar($myArr)){ if($myArr === true){ $line .= '("TRUE")'; } else if($myArr === false){ $line .= '("FALSE")'; } else { $line .= "($myArr)"; } } $line .= "\t"; $line .= gettype($myIndex); if(is_scalar($myIndex)){ if($myIndex === true){ $line .= '("TRUE")'; } else if($myIndex === false){ $line .= '("FALSE")'; } else { $line .= "($myIndex)"; } } $line .= "\t"; $result = check_array($myArr, $myIndex); $line .= $result === false ? "FALSE" : $result; $line .= "\n"; echo $line; } }

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.0000.01517.00
8.3.50.0110.00821.34
8.3.40.0070.00718.72
8.3.30.0040.01119.22
8.3.20.0080.00020.38
8.3.10.0070.00021.65
8.3.00.0080.00317.63
8.2.180.0110.00416.50
8.2.170.0130.00622.96
8.2.160.0070.00720.52
8.2.150.0070.00024.18
8.2.140.0050.00324.66
8.2.130.0070.00026.16
8.2.120.0000.01019.45
8.2.110.0060.00321.04
8.2.100.0080.00419.48
8.2.90.0030.00619.26
8.2.80.0040.00417.97
8.2.70.0050.00517.50
8.2.60.0030.00618.03
8.2.50.0000.00818.07
8.2.40.0100.00018.06
8.2.30.0030.00318.04
8.2.20.0040.00417.66
8.2.10.0040.00418.14
8.2.00.0070.00017.71
8.1.280.0070.00725.92
8.1.270.0040.00420.31
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0000.00822.19
8.1.230.0090.00317.48
8.1.220.0050.00317.78
8.1.210.0040.00418.77
8.1.200.0040.00417.13
8.1.190.0040.00417.35
8.1.180.0030.00718.10
8.1.170.0070.00318.56
8.1.160.0060.00321.96
8.1.150.0040.00418.98
8.1.140.0000.00717.43
8.1.130.0030.00317.86
8.1.120.0070.00017.48
8.1.110.0040.00417.51
8.1.100.0030.00317.38
8.1.90.0030.00317.61
8.1.80.0040.00417.55
8.1.70.0000.00717.47
8.1.60.0000.00717.52
8.1.50.0040.00417.54
8.1.40.0050.00517.50
8.1.30.0050.00317.70
8.1.20.0040.00417.68
8.1.10.0000.00717.54
8.1.00.0130.00017.48
8.0.300.0000.00718.77
8.0.290.0000.00716.63
8.0.280.0030.00318.39
8.0.270.0070.00017.31
8.0.260.0040.00417.17
8.0.250.0060.00016.89
8.0.240.0020.00517.03
8.0.230.0000.00716.89
8.0.220.0060.00016.78
8.0.210.0030.00316.93
8.0.200.0000.00716.98
8.0.190.0040.00416.79
8.0.180.0000.00716.97
8.0.170.0030.00316.83
8.0.160.0000.00816.83
8.0.150.0030.00716.79
8.0.140.0000.00716.87
8.0.130.0000.00613.34
8.0.120.0040.00416.77
8.0.110.0030.00316.92
8.0.100.0040.00416.94
8.0.90.0050.00216.88
8.0.80.0070.01016.92
8.0.70.0000.00716.89
8.0.60.0000.00716.81
8.0.50.0000.00816.92
8.0.30.0080.01417.10
8.0.20.0150.01317.40
8.0.10.0050.00317.01
8.0.00.0110.00816.94
7.4.330.0030.00315.03
7.4.320.0030.00316.41
7.4.300.0060.00016.53
7.4.290.0070.00016.69
7.4.280.0000.00816.63
7.4.270.0000.00716.66
7.4.260.0030.00316.50
7.4.250.0060.00316.61
7.4.240.0000.00716.66
7.4.230.0040.00416.32
7.4.220.0030.01416.53
7.4.210.0060.01116.63
7.4.200.0040.00416.60
7.4.160.0170.00616.50
7.4.150.0100.01017.40
7.4.140.0130.01017.86
7.4.130.0120.00816.69
7.4.120.0080.01516.58
7.4.110.0130.00716.50
7.4.100.0100.01416.37
7.4.90.0090.00916.63
7.4.80.0130.00419.39
7.4.70.0110.00816.48
7.4.60.0060.01316.49
7.4.50.0030.00616.57
7.4.40.0090.00916.51
7.4.30.0130.01016.65
7.3.330.0050.00013.48
7.3.320.0110.00613.33
7.3.310.0000.00716.48
7.3.300.0030.00316.34
7.3.290.0000.00716.32
7.3.280.0090.00716.34
7.3.270.0080.01117.40
7.3.260.0130.01216.75
7.3.250.0120.01216.55
7.3.240.0130.00316.63
7.3.230.0220.00016.42
7.3.210.0030.01416.62
7.3.200.0100.01019.39
7.3.190.0070.01016.63
7.3.180.0060.01116.52
7.3.170.0100.01516.38
7.3.160.0100.00716.43
7.2.330.0090.01916.46
7.2.320.0130.01016.64
7.2.310.0090.00916.52
7.2.300.0120.00616.52
7.2.290.0100.01016.74
7.2.100.2170.01014.66
7.2.90.0090.00914.88
7.2.80.2040.00314.80
7.2.70.2080.00314.88
7.2.60.0050.01515.09
7.2.50.1540.01014.89
7.2.40.0070.00715.20
7.2.30.1430.00315.15
7.2.20.2020.01015.18
7.2.10.1380.00615.03
7.2.00.2200.00315.00
7.1.220.0130.01013.70
7.1.210.0140.00313.90
7.1.200.1320.00613.97
7.1.190.2410.00013.88
7.1.180.0110.00413.86
7.1.170.0160.00414.09
7.1.160.0090.00413.89
7.1.150.0110.00513.76
7.1.140.1650.00313.91
7.1.130.0160.00013.86
7.1.120.1670.00313.90
7.1.110.0560.00613.80
7.1.100.0960.00314.00
7.1.90.2290.00313.98
7.1.80.0120.00314.06
7.1.70.0430.00713.72
7.1.60.2480.01331.62
7.1.50.0380.00431.96
7.1.40.0890.00931.94
7.1.30.0180.01831.46
7.1.20.1160.00731.71
7.1.10.0780.00513.61
7.1.00.1080.01413.69
7.0.310.1500.00713.61
7.0.300.1300.00013.61
7.0.290.0520.01313.61
7.0.280.1040.00313.61
7.0.270.1720.01013.61
7.0.260.1630.00713.61
7.0.250.0120.00413.72
7.0.240.0550.00413.61
7.0.230.0280.00713.71
7.0.220.2590.00113.81
7.0.210.0130.00613.61
7.0.200.1900.00313.61
7.0.190.1880.00313.61
7.0.180.0090.00413.61
7.0.170.1030.00013.61
7.0.160.0070.00713.61
7.0.150.0040.00813.61
7.0.140.1480.00913.77
7.0.130.0380.00313.61
7.0.120.0080.00813.61
7.0.110.1590.00313.64
7.0.100.1010.01013.61
7.0.90.0710.00013.61
7.0.80.0100.00413.65
7.0.70.1550.00313.61
7.0.60.0750.00613.61
7.0.50.0040.01113.79
7.0.40.1460.00313.61
7.0.30.1400.00613.63
7.0.20.1370.00613.63
7.0.10.1480.00413.61
7.0.00.0140.00313.61
5.6.380.0080.00414.43
5.6.370.0030.01114.18
5.6.360.0060.00614.32
5.6.350.0060.00614.22
5.6.340.0130.00014.60
5.6.330.0060.00614.47
5.6.320.0070.00714.27
5.6.310.0130.00614.21
5.6.300.0090.00514.30
5.6.290.0110.00014.41
5.6.280.0070.00514.03
5.6.270.0050.00914.44
5.6.260.0150.00313.98
5.6.250.0120.00614.22
5.6.240.0060.00614.45
5.6.230.0040.00814.43
5.6.220.0090.00614.51
5.6.210.0030.01014.34
5.6.200.0120.00013.91
5.6.190.0040.01114.05
5.6.180.0120.00314.29
5.6.170.0090.00314.25
5.6.160.0110.00314.09
5.6.150.0080.00313.97
5.6.140.0080.00614.32
5.6.130.0000.01314.20
5.6.120.0120.00014.19
5.6.110.0030.01114.02
5.6.100.0100.00514.37
5.6.90.0080.00514.20
5.6.80.0030.00914.04
5.6.70.0110.00614.27
5.6.60.0130.00614.62
5.6.50.0130.00614.16
5.6.40.0140.00314.35
5.6.30.0070.00914.38
5.6.20.0140.00514.41
5.5.380.0040.00713.61
5.5.370.0000.01313.61
5.5.360.0000.00913.61
5.5.350.0060.00613.61
5.5.340.0000.00813.61
5.5.330.0030.00713.61
5.5.320.0070.00413.61
5.5.310.0060.00613.61
5.5.300.0000.00913.61
5.5.290.0030.00813.61
5.5.280.0110.00413.61
5.5.270.0070.00513.61
5.5.260.0100.00013.61
5.5.250.0120.00013.61
5.5.240.0060.00613.61
5.5.230.0070.00713.61
5.5.220.0050.00513.61
5.5.210.0060.00613.61
5.5.200.0000.01013.61
5.5.190.0080.00813.61
5.4.450.0040.00413.61
5.4.440.0030.00713.61
5.4.430.0030.00613.61
5.4.420.0070.00413.61
5.4.410.0000.01313.61
5.4.400.0090.00013.61
5.4.390.0040.00913.61
5.4.380.0040.00713.61
5.4.370.0060.00613.61
5.4.360.0040.00813.61
5.4.350.0040.00913.61

preferences:
50.36 ms | 401 KiB | 5 Q