3v4l.org

run code in 300+ PHP versions simultaneously
<?php $list = [1,2,3,3,44,5,6,2,3,2,33,8,8,6,"Kanyin",9,24,21,3,'adeola3','Adeola3',44,5,102,33,43,"Kanyin", "Kanyinsola", "Adeola", "adeola", "Adeolas", "Adeola1","Adeola"]; //bubbleSort($list); binarySearch( 44, $list, 1, 5); function binarySearch( $target, array $list, $low, $high ) { if( $low > $high ) { echo "Not found!"; return false; } $middle = ( $low + $high ) / 2; if( $target == $list[$middle] ) { echo "Found $target at $middle"; return true; } else if($target > $list[ $middle ]) { return binarySearch( $target, $list, $middle + 1, $high ); } else{ return binarySearch( $target, $list, $low, $middle - 1 ); } } function bubbleSort( array $lst ) { $numList = count( $lst ); $swapped = false; do{ $swapped = false; for( $i=0; $i < $numList - 1; $i++ ) { if( $lst[$i] > $lst[$i+1]){ $temp = $lst[$i]; $lst[$i] = $lst[$i+1]; $lst[$i+1] = $temp; $swapped = true; } } } while ( $swapped == true); echo ( implode(" ", $lst)); } //selectionSort( $list ); function selectionSort( array $lst ) { $numList = count( $lst ); for( $i=0; $i < $numList; $i++ ) { $index = 0; $smallest = $lst[$i]; for( $j = $i; $j < $numList; $j++ ) { if( $lst[$j] < $smallest ) { $smallest = $lst[$j]; $index = $j; } $temp = $lst[$i]; $lst[$i] = $smallest; $lst[$index] = $temp; } echo ( implode(" ", $lst)); } } //linearSearch( $list, 3 ); function linearSearch( array $lst, $target ) { $numList = count( $lst ); for( $i=0; $i < $numList; $i++ ) { if( $lst[$i] == $target ) { echo "Found $target at $i\n"; } } } //factoral(6); function factoral( $n ) { if( $n == 1 ) { return 1; } echo $n * factoral( $n -1 ); } function chessboard() { for($i=0; $i<6; $i++) { echo "$i X0 :"; for($j=0; $j<$i; $j++) { echo "*"; } echo "\n"; } } //chessboard();

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.0040.01216.63
8.3.60.0130.00717.00
8.3.50.0140.00716.46
8.3.40.0110.00418.79
8.3.30.0040.01418.84
8.3.20.0040.00420.30
8.3.10.0040.00421.77
8.3.00.0000.00823.61
8.2.190.0140.00716.58
8.2.180.0140.00418.66
8.2.170.0110.00818.94
8.2.160.0070.00722.96
8.2.150.0040.00425.66
8.2.140.0040.00424.66
8.2.130.0040.00422.29
8.2.120.0050.00326.35
8.2.110.0030.00621.11
8.2.100.0080.00320.39
8.2.90.0000.00919.46
8.2.80.0000.00818.34
8.2.70.0060.00318.05
8.2.60.0030.00618.11
8.2.50.0030.00518.10
8.2.40.0000.00822.32
8.2.30.0080.00019.38
8.2.20.0000.00818.13
8.2.10.0040.00418.08
8.2.00.0000.00718.25
8.1.280.0130.00325.92
8.1.270.0070.00023.82
8.1.260.0000.00826.35
8.1.250.0000.00828.09
8.1.240.0080.00022.23
8.1.230.0080.00819.10
8.1.220.0040.00417.74
8.1.210.0040.00418.77
8.1.200.0050.00517.38
8.1.190.0050.00517.48
8.1.180.0030.00518.10
8.1.170.0040.00418.59
8.1.160.0000.00818.98
8.1.150.0050.00318.82
8.1.140.0030.00617.67
8.1.130.0080.00418.82
8.1.120.0000.00717.54
8.1.110.0040.00417.41
8.1.100.0040.00417.47
8.1.90.0000.00817.51
8.1.80.0000.00817.46
8.1.70.0070.00017.52
8.1.60.0040.00417.62
8.1.50.0030.00517.60
8.1.40.0060.00317.55
8.1.30.0060.00317.55
8.1.20.0080.00017.65
8.1.10.0080.00017.56
8.1.00.0040.00417.45
8.0.300.0040.00419.73
8.0.290.0080.00016.88
8.0.280.0030.00318.50
8.0.270.0100.00017.18
8.0.260.0000.00819.10
8.0.250.0070.00016.91
8.0.240.0030.00316.97
8.0.230.0030.00317.02
8.0.220.0000.00716.98
8.0.210.0030.00316.91
8.0.200.0070.00016.92
8.0.190.0040.00416.94
8.0.180.0000.00716.90
8.0.170.0000.00817.01
8.0.160.0000.00716.97
8.0.150.0060.00316.88
8.0.140.0030.00716.88
8.0.130.0000.00713.46
8.0.120.0000.00716.82
8.0.110.0060.00316.89
8.0.100.0080.00016.80
8.0.90.0040.00416.99
8.0.80.0100.00416.99
8.0.70.0050.00216.89
8.0.60.0000.00716.83
8.0.50.0030.00616.99
8.0.30.0100.00817.14
8.0.20.0090.01017.40
8.0.10.0070.00016.89
8.0.00.0100.00716.80
7.4.330.0020.00216.67
7.4.320.0030.00316.66
7.4.300.0060.00016.62
7.4.290.0110.00016.58
7.4.280.0070.00016.58
7.4.270.0080.00016.59
7.4.260.0070.00016.55
7.4.250.0040.00416.55
7.4.240.0000.00816.53
7.4.230.0000.00816.68
7.4.220.0070.01116.48
7.4.210.0080.00716.63
7.4.200.0000.00716.42
7.4.160.0120.00716.60
7.4.150.0120.00617.40
7.4.140.0110.00917.86
7.4.130.0180.00616.62
7.4.120.0110.00816.58
7.4.110.0110.00516.44
7.4.100.0100.01316.50
7.4.90.0000.01616.61
7.4.80.0110.00719.39
7.4.70.0060.01516.63
7.4.60.0120.00916.48
7.4.50.0040.00816.46
7.4.40.0110.00616.67
7.4.30.0030.01316.67
7.4.00.0080.00614.96
7.3.330.0000.00613.43
7.3.320.0000.00713.41
7.3.310.0000.00716.22
7.3.300.0070.00016.29
7.3.290.0050.00316.29
7.3.280.0100.00716.42
7.3.270.0110.00617.40
7.3.260.0080.00916.48
7.3.250.0140.00716.51
7.3.240.0070.01216.41
7.3.230.0120.00416.50
7.3.210.0140.00316.55
7.3.200.0110.00516.43
7.3.190.0060.01016.66
7.3.180.0100.00716.40
7.3.170.0170.00316.35
7.3.160.0100.01016.40
7.3.120.0130.00615.04
7.3.110.0110.00714.65
7.3.100.0120.00315.03
7.3.90.0120.00015.18
7.3.80.0090.00614.62
7.3.70.0040.01115.04
7.3.60.0070.01114.71
7.3.50.0150.00014.88
7.3.40.0090.00014.85
7.3.30.0060.01214.94
7.3.20.0060.01016.66
7.3.10.0020.00916.71
7.3.00.0060.00416.63
7.2.330.0180.00316.90
7.2.320.0130.00916.47
7.2.310.0120.00916.66
7.2.300.0100.00716.83
7.2.290.0190.00016.89
7.2.250.0090.00915.04
7.2.240.0100.01015.33
7.2.230.0030.01215.29
7.2.220.0030.00715.29
7.2.210.0100.00015.30
7.2.200.0070.00414.93
7.2.190.0100.00615.23
7.2.180.0000.01415.27
7.2.170.0100.00314.90
7.2.130.0070.00716.88
7.2.120.0030.01016.97
7.2.110.0050.00516.77
7.2.100.0040.00417.07
7.2.90.0060.01217.17
7.2.80.0060.00616.88
7.2.70.0070.00716.97
7.2.60.0030.01016.84
7.2.50.0070.00716.84
7.2.40.0080.00416.88
7.2.30.0000.00916.92
7.2.20.0070.00316.77
7.2.10.0070.01016.95
7.2.00.0030.00716.55
7.1.330.0000.01515.71
7.1.320.0060.00915.63
7.1.310.0000.01115.77
7.1.300.0060.01215.82
7.1.290.0000.01115.93
7.1.280.0030.01015.75
7.1.270.0040.00815.75
7.1.260.0080.00315.86
7.1.250.0000.01315.75
7.1.200.0200.00015.92
7.1.110.0760.00616.02
7.1.100.0630.00416.23
7.1.90.0790.00316.07
7.1.80.0530.01315.98
7.1.70.0490.01015.25
7.1.60.0610.01133.29
7.1.50.0590.01032.98
7.1.40.0660.00332.71
7.1.30.0620.01332.78
7.1.20.1200.01332.85
7.1.10.0500.01014.86
7.1.00.0480.01415.13
7.0.250.0890.01415.47
7.0.240.0030.01016.05
7.0.230.0610.01615.80
7.0.220.0850.01015.79
7.0.210.0520.00614.73
7.0.200.0630.00414.85
7.0.190.0660.00314.95
7.0.180.0430.01314.59
7.0.170.0690.00014.76
7.0.160.0700.01014.59
7.0.150.0560.01014.59
7.0.140.0670.00914.77
7.0.130.0550.01014.73
7.0.120.0550.01014.78
7.0.110.0580.01614.62
7.0.100.0570.01014.59
7.0.90.0370.01014.63
7.0.80.0620.00614.65
7.0.70.0290.01114.33
7.0.60.0570.01314.25
7.0.50.0360.00714.77
7.0.40.0450.01214.86
7.0.30.0570.01314.80
7.0.20.0530.01614.56
7.0.10.0590.00314.70
7.0.00.0840.00714.70

preferences:
66.07 ms | 401 KiB | 5 Q