3v4l.org

run code in 300+ PHP versions simultaneously
<?php $start = 7 ; // try with 1, 7, 24, 75... $pagination_count = 40 ; // Number of results $maxrecords = 10 ; $num_pages = ceil($pagination_count / $maxrecords) ; // echo "num_pages=$num_pages\n" ; // Just for dev if ($start > $num_pages) { $start = $num_pages; } if ($num_pages < 6) { for ($i = 0; $i < $num_pages ; $i++) { echo render_page_link($i, $start); } } else { // Begining for ($i = 0 ; $i < min(3, $num_pages); $i++) { echo render_page_link($i,$start) ; } echo ' (...) ' ; $have_middle = ($start > 3 && $start <= $num_pages - 3) ; if ($have_middle) { // Around current for ($i = max(3, $start - 3); $i < min($start + 3 - 1, $num_pages - 3) ; $i++) { echo render_page_link($i,$start) ; } } // Ending if ($have_middle) echo ' (...) ' ; for ($i = $num_pages - 3; $i < $num_pages ; $i++) { echo render_page_link($i,$start); } } echo "\n"; // just because I test on CLI. // Here is a little function to display the link: // Currently just "plain text", but could be <a> or <span> with CSS... function render_page_link($index, $current = -1) { if ($index != $current - 1) return ($index+1) . " " ; return "[".($index+1)."] " ; }

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.5.00.0110.01120.04
8.4.150.0020.00014.05
8.4.140.0130.00817.62
8.4.130.0140.00618.64
8.4.120.0060.00624.33
8.4.110.0110.00920.65
8.4.100.0010.00817.55
8.4.90.0090.01317.79
8.4.80.0050.00417.81
8.4.70.0130.00717.76
8.4.60.0090.01217.51
8.4.50.0090.01317.91
8.4.40.0070.01317.72
8.4.30.0060.00320.60
8.4.20.0100.01017.87
8.4.10.0060.00321.94
8.3.280.0110.00918.44
8.3.270.0110.00816.86
8.3.260.0120.00716.67
8.3.250.0130.00318.83
8.3.240.0110.00917.30
8.3.230.0120.00716.66
8.3.220.0140.00417.04
8.3.210.0060.00816.68
8.3.200.0120.00916.48
8.3.190.0100.00816.66
8.3.180.0100.00616.61
8.3.170.0060.00316.61
8.3.160.0070.01418.55
8.3.150.0090.00917.36
8.3.140.0050.00318.94
8.3.130.0080.00018.50
8.3.120.0040.00417.01
8.3.110.0090.00616.59
8.3.100.0100.01016.43
8.3.90.0230.01021.58
8.3.80.0200.00923.06
8.3.70.0210.01021.70
8.3.60.0180.01022.60
8.3.50.0200.00825.29
8.3.40.0170.00822.72
8.3.30.0170.01222.74
8.3.20.0220.00425.47
8.3.10.0130.00825.71
8.3.00.0150.00526.46
8.2.290.0070.00220.52
8.2.280.0060.00318.41
8.2.270.0070.01116.59
8.2.260.0070.01017.44
8.2.250.0080.00016.60
8.2.240.0040.00417.40
8.2.230.0000.00820.94
8.2.220.0110.00424.06
8.2.210.0200.00726.77
8.2.200.0230.00222.82
8.2.190.0220.01022.46
8.2.180.0130.00626.34
8.2.170.0140.00622.78
8.2.160.0120.00824.87
8.2.150.0120.00226.21
8.2.140.0120.00225.71
8.2.130.0100.00426.46
8.2.120.0140.00023.61
8.2.110.0170.00423.56
8.2.100.0260.00722.36
8.2.90.0200.00822.20
8.2.80.0120.00622.77
8.2.70.0190.00622.13
8.2.60.0160.01022.40
8.2.50.0190.00822.41
8.2.40.0140.01022.49
8.2.30.0190.00422.39
8.2.20.0210.00322.44
8.2.10.0100.01223.05
8.2.00.0110.00923.05
8.1.330.0110.00916.91
8.1.320.0050.01416.06
8.1.310.0110.00716.87
8.1.300.0090.00919.31
8.1.290.0190.00528.80
8.1.280.0200.00326.34
8.1.270.0140.00325.40
8.1.260.0170.00726.56
8.1.250.0150.00927.43
8.1.240.0150.00822.91
8.1.230.0210.00422.23
8.1.220.0130.00622.25
8.1.210.0100.00622.77
8.1.200.0090.00521.95
8.1.190.0120.00222.00
8.1.180.0180.00624.65
8.1.170.0180.00322.70
8.1.160.0130.00822.84
8.1.150.0160.00722.79
8.1.140.0210.00422.79
8.1.130.0150.01123.48
8.1.120.0150.00522.14
8.1.110.0200.00422.12
8.1.100.0190.00522.11
8.1.90.0170.00522.13
8.1.80.0210.00322.06
8.1.70.0190.00522.15
8.1.60.0180.00822.18
8.1.50.0120.01022.17
8.1.40.0210.00022.09
8.1.30.0090.00422.22
8.1.20.0180.00622.18
8.1.10.0210.00322.13
8.1.00.0170.00822.07
8.0.300.0140.01022.77
8.0.290.0190.00421.76
8.0.280.0240.00323.52
8.0.270.0240.00422.36
8.0.260.0150.00522.59
8.0.250.0170.00521.87
8.0.240.0130.00521.86
8.0.230.0100.00521.82
8.0.220.0090.00321.84
8.0.210.0150.00421.83
8.0.200.0170.00621.85
8.0.190.0150.00721.89
8.0.180.0150.00721.89
8.0.170.0130.01021.86
8.0.160.0130.01021.89
8.0.150.0180.00521.80
8.0.140.0160.00621.76
8.0.130.0150.00720.07
8.0.120.0170.00721.84
8.0.110.0160.00321.81
8.0.100.0110.00421.74
8.0.90.0090.00721.79
8.0.80.0140.00920.19
8.0.70.0210.00721.79
8.0.60.0150.00421.82
8.0.50.0170.00621.77
8.0.30.0190.00921.84
8.0.20.0200.01021.86
8.0.10.0240.00621.79
8.0.00.0200.01021.87
7.4.330.0150.00521.16
7.4.320.0150.00621.70
7.4.300.0170.00721.59
7.4.290.0160.00521.63
7.4.280.0140.00821.68
7.4.270.0170.00421.65
7.4.260.0180.00320.04
7.4.250.0180.00321.67
7.4.240.0160.00521.63
7.4.230.0180.00521.59
7.4.220.0090.00719.99
7.4.210.0120.00818.63
7.4.200.0150.00121.69
7.4.190.0160.01226.77
7.4.180.0360.00026.77
7.4.160.0300.00626.77
7.4.150.0200.00821.47
7.4.140.0170.00821.40
7.4.130.0250.00221.47
7.4.120.0200.00921.54
7.4.110.0210.00521.46
7.4.100.0200.00821.49
7.4.90.0170.00921.53
7.4.80.0190.00821.48
7.4.70.0150.01021.67
7.4.60.0190.00421.43
7.4.50.0180.00921.64
7.4.40.0190.00521.50
7.4.30.0190.00721.54
7.4.20.0150.00921.59
7.4.10.0170.01121.59
7.4.00.0150.00421.67
7.3.330.0090.00221.60
7.3.320.0090.00420.05
7.3.310.0090.00421.51
7.3.300.0120.00221.58
7.3.290.0080.00918.97
7.3.280.0180.00926.77
7.3.270.0200.00721.45
7.3.260.0180.00821.59
7.3.250.0180.00821.55
7.3.240.0180.00721.67
7.3.230.0160.00921.58
7.3.220.0210.00521.51
7.3.210.0220.00321.50
7.3.200.0130.01121.55
7.3.190.0220.00521.54
7.3.180.0130.01321.57
7.3.170.0210.00521.62
7.3.160.0230.00321.57
7.3.150.0110.01521.54
7.3.140.0180.01021.54
7.3.130.0220.00921.55
7.3.120.0150.01121.67
7.3.110.0140.01121.60
7.3.100.0150.00821.63
7.3.90.0180.01021.57
7.3.80.0190.01021.55
7.3.70.0210.00821.63
7.3.60.0230.00521.55
7.3.50.0210.00721.59
7.3.40.0180.00821.51
7.3.30.0200.00821.60
7.3.20.0220.00821.53
7.3.10.0150.01221.70
7.3.00.0260.00521.57

preferences:
35.55 ms | 403 KiB | 5 Q