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,44,5,102,33,43,"Kanyin", "Kanyinsola", "Adeola", "adeola", "Adeolas", "Adeola1","Adeola"]; bubbleSort($list); 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.0110.00418.43
8.3.60.0070.01416.38
8.3.50.0060.01216.40
8.3.40.0040.01118.79
8.3.30.0150.00618.84
8.3.20.0050.00320.16
8.3.10.0080.00023.36
8.3.00.0030.00523.65
8.2.190.0060.00916.75
8.2.180.0110.00718.08
8.2.170.0090.00922.96
8.2.160.0120.00320.27
8.2.150.0040.00425.66
8.2.140.0080.00024.66
8.2.130.0000.00822.30
8.2.120.0040.00426.35
8.2.110.0030.00622.25
8.2.100.0120.00017.84
8.2.90.0120.00017.75
8.2.80.0040.00418.86
8.2.70.0000.00818.05
8.2.60.0080.00018.22
8.2.50.0040.00419.25
8.2.40.0100.00319.41
8.2.30.0000.00819.22
8.2.20.0000.00818.16
8.2.10.0040.00418.03
8.2.00.0040.00418.15
8.1.280.0080.00825.92
8.1.270.0080.00023.74
8.1.260.0040.00426.35
8.1.250.0080.00028.09
8.1.240.0090.00623.90
8.1.230.0040.00817.76
8.1.220.0000.00817.74
8.1.210.0080.00018.77
8.1.200.0070.00317.48
8.1.190.0080.00017.23
8.1.180.0060.00318.10
8.1.170.0040.00420.25
8.1.160.0050.00519.04
8.1.150.0050.00218.79
8.1.140.0000.00817.69
8.1.130.0080.00018.95
8.1.120.0000.00717.54
8.1.110.0040.00417.37
8.1.100.0050.00317.44
8.1.90.0030.00417.47
8.1.80.0050.00317.37
8.1.70.0030.00317.39
8.1.60.0050.00317.54
8.1.50.0040.00417.44
8.1.40.0060.00617.50
8.1.30.0040.00417.72
8.1.20.0030.00517.63
8.1.10.0040.00417.48
8.1.00.0040.00417.49
8.0.300.0040.00418.77
8.0.290.0030.00516.63
8.0.280.0000.00718.35
8.0.270.0090.00017.33
8.0.260.0030.00320.78
8.0.250.0070.00316.88
8.0.240.0030.00316.87
8.0.230.0000.00816.96
8.0.220.0040.00416.88
8.0.210.0030.00316.91
8.0.200.0040.00416.84
8.0.190.0050.00316.93
8.0.180.0030.00516.96
8.0.170.0040.00416.84
8.0.160.0050.00216.82
8.0.150.0040.00416.92
8.0.140.0080.00316.87
8.0.130.0000.00513.23
8.0.120.0050.00316.75
8.0.110.0040.00416.95
8.0.100.0030.00616.98
8.0.90.0040.00416.78
8.0.80.0000.01516.89
8.0.70.0080.00016.94
8.0.60.0020.00516.87
8.0.50.0040.00416.73
8.0.30.0120.00917.27
8.0.20.0100.01017.43
8.0.10.0030.00617.09
8.0.00.0120.00616.68
7.4.330.0050.00016.82
7.4.320.0030.00316.63
7.4.300.0040.00416.53
7.4.290.0040.00416.63
7.4.280.0060.00316.62
7.4.270.0030.00316.64
7.4.260.0050.00216.57
7.4.250.0030.00516.52
7.4.240.0000.00816.55
7.4.230.0000.00716.72
7.4.220.0110.01116.70
7.4.210.0040.01116.54
7.4.200.0020.00516.47
7.4.160.0030.01216.61
7.4.150.0070.01117.40
7.4.140.0110.00917.86
7.4.130.0140.00616.45
7.4.120.0140.00816.57
7.4.110.0110.00716.43
7.4.100.0090.00916.51
7.4.90.0110.00716.62
7.4.80.0030.01419.39
7.4.70.0060.01716.42
7.4.60.0030.01516.36
7.4.50.0090.00916.51
7.4.40.0060.01016.55
7.4.30.0040.01216.59
7.4.00.0000.01515.22
7.3.330.0000.00513.39
7.3.320.0030.00313.39
7.3.310.0000.00716.25
7.3.300.0000.00716.37
7.3.290.0040.00416.27
7.3.280.0090.00716.38
7.3.270.0120.00917.40
7.3.260.0100.00916.59
7.3.250.0120.00916.50
7.3.240.0130.00716.50
7.3.230.0130.00416.67
7.3.210.0030.01616.39
7.3.200.0060.01616.67
7.3.190.0080.00816.30
7.3.180.0070.01416.33
7.3.170.0060.01116.59
7.3.160.0110.00516.58
7.3.10.0040.00916.79
7.3.00.0060.00516.58
7.2.330.0090.01416.77
7.2.320.0160.00816.45
7.2.310.0110.00716.87
7.2.300.0110.00816.83
7.2.290.0070.01916.66
7.2.130.0020.01016.84
7.2.120.0070.00216.90
7.2.110.0020.01116.96
7.2.100.0160.00616.10
7.2.90.1860.00816.31
7.2.80.1720.00816.23
7.2.70.1510.01216.22
7.2.60.0100.00916.27
7.2.50.0250.00816.56
7.2.40.1420.00616.29
7.2.30.0100.01016.32
7.2.20.0200.00816.36
7.2.10.0350.00716.43
7.2.00.0130.00716.33
7.1.250.0050.00815.74
7.1.220.0120.00613.94
7.1.210.0200.00013.99
7.1.200.2430.00315.01
7.1.190.3930.00713.83
7.1.180.2150.01013.96
7.1.170.0210.00014.00
7.1.160.4870.01013.91
7.1.150.1390.00314.05
7.1.140.0170.00714.04
7.1.130.0180.00413.76
7.1.120.0170.00314.04
7.1.110.0250.00415.06
7.1.100.0380.00914.89
7.1.90.0210.00715.10
7.1.80.0190.00514.99
7.1.70.0270.00814.61
7.1.60.0310.01032.67
7.1.50.0530.00832.36
7.1.40.0340.00932.53
7.1.30.0500.00832.27
7.1.20.0450.01232.38
7.1.10.0210.00914.48
7.1.00.0180.00514.50
7.0.310.4760.00013.24
7.0.300.0200.00313.56
7.0.290.1740.01013.63
7.0.280.2420.00713.37
7.0.270.1600.01013.59
7.0.260.3340.00313.51
7.0.250.1150.00614.65
7.0.240.1400.00714.92
7.0.230.0210.00914.91
7.0.220.0240.01114.86
7.0.210.0850.00514.24
7.0.200.0150.01314.25
7.0.190.0210.00714.34
7.0.180.0260.00613.99
7.0.170.0330.00914.10
7.0.160.0200.00814.13
7.0.150.0360.00514.23
7.0.140.0230.00714.09
7.0.130.0230.00514.42
7.0.120.0240.00714.22
7.0.110.0440.01114.06
7.0.100.0450.01114.05
7.0.90.0340.00514.12
7.0.80.0220.00713.98
7.0.70.0140.01314.05
7.0.60.0630.01114.02
7.0.50.0230.00614.22
7.0.40.0370.01614.32
7.0.30.0180.00914.30
7.0.20.0250.00914.18
7.0.10.0210.01414.34
7.0.00.0210.01114.43
5.6.380.0060.01214.18

preferences:
58.42 ms | 401 KiB | 5 Q