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, 6); 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.60.0150.00016.75
8.3.50.0070.01016.48
8.3.40.0090.00618.80
8.3.30.0070.01018.67
8.3.20.0040.00420.24
8.3.10.0040.00421.72
8.3.00.0050.00323.61
8.2.180.0130.00618.25
8.2.170.0040.01122.96
8.2.160.0100.00320.38
8.2.150.0040.00424.18
8.2.140.0040.00424.66
8.2.130.0040.00422.10
8.2.120.0080.00026.35
8.2.110.0030.00722.22
8.2.100.0080.00417.88
8.2.90.0030.00919.35
8.2.80.0050.00317.97
8.2.70.0030.00617.63
8.2.60.0000.00917.93
8.2.50.0030.00518.10
8.2.40.0030.00622.20
8.2.30.0040.00419.35
8.2.20.0030.00518.21
8.2.10.0000.00718.19
8.2.00.0060.00318.17
8.1.270.0000.00823.91
8.1.260.0050.00226.35
8.1.250.0080.00028.09
8.1.240.0160.00323.83
8.1.230.0070.00420.28
8.1.220.0060.00317.74
8.1.210.0030.00518.77
8.1.200.0000.00917.23
8.1.190.0050.00317.35
8.1.180.0040.00418.10
8.1.170.0090.00018.71
8.1.160.0000.00819.06
8.1.150.0040.00418.82
8.1.140.0040.00417.74
8.1.130.0090.00018.99
8.1.120.0000.00717.53
8.1.110.0000.00817.36
8.1.100.0030.00317.39
8.1.90.0040.00417.53
8.1.80.0000.00717.42
8.1.70.0030.00517.53
8.1.60.0060.00317.67
8.1.50.0040.00417.62
8.1.40.0040.00717.45
8.1.30.0040.00717.58
8.1.20.0000.00817.70
8.1.10.0080.00017.55
8.1.00.0050.00517.60
8.0.300.0000.00818.77
8.0.290.0000.00716.88
8.0.280.0030.00318.40
8.0.270.0030.00617.36
8.0.260.0040.00420.84
8.0.250.0030.00316.95
8.0.240.0030.00317.02
8.0.230.0070.00017.02
8.0.220.0050.00216.95
8.0.210.0040.00416.83
8.0.200.0040.00416.86
8.0.190.0020.00516.82
8.0.180.0040.00416.94
8.0.170.0000.00716.95
8.0.160.0000.00816.83
8.0.150.0000.00716.80
8.0.140.0130.00016.89
8.0.130.0060.00013.33
8.0.120.0000.00716.90
8.0.110.0040.00416.86
8.0.100.0000.00716.95
8.0.90.0070.00016.75
8.0.80.0000.01516.84
8.0.70.0040.00416.69
8.0.60.0040.00416.91
8.0.50.0030.00616.74
8.0.30.0110.00817.01
8.0.20.0090.00917.40
8.0.10.0070.00017.11
8.0.00.0110.00716.84
7.4.330.0000.00616.76
7.4.320.0070.00016.57
7.4.300.0000.00616.58
7.4.290.0030.00716.71
7.4.280.0040.00416.65
7.4.270.0030.00316.50
7.4.260.0000.00716.58
7.4.250.0030.00316.68
7.4.240.0040.00416.54
7.4.230.0000.00716.54
7.4.220.0140.00416.64
7.4.210.0100.01016.65
7.4.200.0040.00416.63
7.4.160.0110.00716.62
7.4.150.0060.01117.40
7.4.140.0130.00517.86
7.4.130.0090.01516.69
7.4.120.0100.00816.64
7.4.110.0070.01016.48
7.4.100.0090.01216.54
7.4.90.0000.01616.60
7.4.80.0090.00919.39
7.4.70.0090.01216.49
7.4.60.0140.00716.51
7.4.50.0100.00616.51
7.4.40.0000.02216.70
7.4.30.0160.00016.54
7.4.00.0080.00614.89
7.3.330.0020.00213.38
7.3.320.0060.00013.16
7.3.310.0000.00716.16
7.3.300.0000.00716.30
7.3.290.0070.00016.38
7.3.280.0080.01016.35
7.3.270.0110.00717.40
7.3.260.0100.01016.49
7.3.250.0100.01016.50
7.3.240.0100.01016.61
7.3.230.0080.00816.53
7.3.210.0030.01616.48
7.3.200.0090.00616.42
7.3.190.0130.00316.64
7.3.180.0080.01016.68
7.3.170.0130.00616.48
7.3.160.0080.00816.53
7.3.120.0090.00514.99
7.3.110.0070.01014.62
7.3.100.0050.01014.82
7.3.90.0040.00915.01
7.3.80.0060.00614.72
7.3.70.0130.00214.89
7.3.60.0000.01414.99
7.3.50.0070.00314.69
7.3.40.0080.00714.95
7.3.30.0060.00714.94
7.3.20.0080.00616.63
7.3.10.0060.00616.64
7.3.00.0040.00716.54
7.2.330.0090.01216.50
7.2.320.0190.00416.43
7.2.310.0030.02016.73
7.2.300.0170.00016.75
7.2.290.0100.01416.59
7.2.250.0080.01115.10
7.2.240.0080.01115.00
7.2.230.0090.00715.24
7.2.220.0040.00915.01
7.2.210.0080.00714.92
7.2.200.0050.01114.92
7.2.190.0110.00415.06
7.2.180.0040.00815.03
7.2.170.0030.01014.79
7.2.110.0040.01116.82
7.2.60.0110.00717.05
7.2.50.0040.01116.75
7.1.330.0030.01415.75
7.1.320.0040.00615.69
7.1.310.0090.00515.68
7.1.300.0090.00515.65
7.1.290.0070.00715.75
7.1.280.0060.00615.68
7.1.270.0060.00615.51
7.1.260.0000.00915.79
7.1.200.0060.00315.40
7.1.110.0900.01016.29
7.1.100.0870.01416.33
7.1.90.0950.00316.07
7.1.80.0510.01315.95
7.1.70.0480.00715.36
7.1.60.0820.01332.97
7.1.50.0940.01032.61
7.1.40.0780.01432.72
7.1.30.0890.01732.87
7.1.20.0680.01032.88
7.1.10.0650.01014.86
7.1.00.0570.01314.88
7.0.250.0670.01115.77
7.0.240.0730.00916.12
7.0.230.0560.01015.76
7.0.220.0610.00315.78
7.0.210.0500.00614.91
7.0.200.0870.00714.90
7.0.190.0660.00614.57
7.0.180.0690.01014.58
7.0.170.0460.01614.45
7.0.160.0760.01714.56
7.0.150.0490.00914.57
7.0.140.0660.01014.65
7.0.130.0660.01614.75
7.0.120.0650.01314.82
7.0.110.0580.01414.72
7.0.100.0460.01314.25
7.0.90.0400.01314.35
7.0.80.0380.00014.70
7.0.70.0420.01214.70
7.0.60.0500.01014.18
7.0.50.0230.01214.64
7.0.40.0300.00714.66
7.0.30.0570.00714.68
7.0.20.0510.00614.73
7.0.10.0770.00314.70
7.0.00.0980.01314.54

preferences:
54.65 ms | 400 KiB | 5 Q