3v4l.org

run code in 300+ PHP versions simultaneously
<?php $item_list = array( "Afghanistan", "Albania", "Algeria", "Andorra", "Angola", "Anguilla", "Antigua & Barbuda", "Argentina", "Armenia", "Aruba", "Australia", "Austria", "Azerbaijan", "Bahamas", "Bahrain", "Bangladesh", "Barbados", "Belarus", "Belau (Palau)", "Belgium", "Belize", "Benin", "Bermuda", "Bhutan", "Bolivia", "Bosnia Herzegovina", "Botswana", "Brazil", "British Indian Ocean", "British Virgin Islands", "Brunei Darussalam", "Bulgaria", "Burkina Faso", "Burundi", "Cambodia", "Cameroon", "Canada", "Cape Verde", "Cayman Islands", "Central African Rep.", "Chad", "Chile", "China (PR)", "Christmas Island", "Cocos Island", "Colombia", "Comoros", "Congo", "Congo Dem. Rep.", "Costa Rica", "Cote d'Ivoire", "Croatia", "Cuba", "Cyprus", "Czech Republic", "Denmark", "Djibouti", "Dominica", "Dominican Republic", "East Timor", "Ecuador", "Egypt", "El Salvador", "Equatorial Guinea", "Eritrea", "Estonia", "Ethiopia", "Falkland Islands", "Faroe Islands", "Fiji", "Finland", "France", "French Guiana", "French Polynesia", "French Antarctic", "Gabon", "Gambia", "Georgia", "Germany", "Ghana", "Gibraltar", "Greece", "Greenland", "Grenada", "Guam", "Guatemala", "Guinea", "Guinea Bissau", "Guyana", "Haiti", "Honduras", "Hong Kong", "Hungary", "Iceland", "India", "Indonesia", "Iran", "Iraq", "Irish Republic", "Israel", "Italy", "Jamaica", "Japan", "Jordan", "Kazakhstan", "Kenya", "Kirghizstan/Kyrgyzstan", "Kiribati", "Korea (DPR)", "Korea (Republic of)", "Kuwait", "Laos", "Latvia", "Lebanon", "Lesotho", "Liberia", "Libya", "Liechtenstein", "Lithuania", "Luxembourg", "Macao", "Macedonia (FYR)", "Madagascar", "Malawi", "Malaysia", "Maldives", "Mali", "Malta", "Marshall Islands", "Mauritania", "Mauritius", "Mexico", "Micronesia", "Moldova", "Monaco", "Mongolia", "Montenegro", "Montserrat", "Morocco", "Mozambique", "Myanmar (Burma)", "Namibia", "Nauru Island", "Nepal", "Netherland Antilles", "Netherlands", "New Caledonia", "New Zealand", "Nicaragua", "Niger Republic", "Nigeria", "Norfolk Island", "Northern Mariana Isl", "Norway", "Oman", "Pakistan", "Panama", "Papua New Guinea", "Paraguay", "Peru", "Philippines", "Pitcairn Island", "Poland", "Portugal", "Puerto Rico", "Qatar", "Reunion", "Romania", "Russia", "Rwanda", "Samoa (American)", "San Marino", "Sao Tome & Principe", "Saudi Arabia", "Senegal", "Seychelles", "Sierra Leone", "Singapore", "Slovak Republic", "Slovenia", "Solomon Islands", "Somalia", "South Africa", "South Georgia", "Spain", "Sri Lanka", "St Kitts & Nevis", "St Helena", "St Lucia", "St Pierre & Miquelon", "St Vincent & Grenadines", "Sudan", "Suriname", "Swaziland", "Sweden", "Switzerland", "Syria", "Taiwan", "Tajikistan", "Tanzania", "Thailand", "Togo", "Tonga", "Trinidad & Tobago", "Tunisia", "Turkey", "Turkmenistan", "Turks & Caicos Islands", "Tuvalu", "Uganda", "Ukraine", "United Arab Emirates", "United Kingdom", "Uruguay", "USA", "Uzbekistan", "Vanuatu", "Vatican City State", "Venezuela", "Vietnam", "Virgin Islands (USA)", "Wallis & Futuna Islands", "Western Samoa", "Yemen", "Zambia", "Zimbabwe"); $minimum_items_per_page = 30; $page_list = paginate_items($item_list, $minimum_items_per_page); print_r($page_list); //------------------------------------------------------------ function paginate_items($item_list, $minimum_items_per_page){ $item_count = count ($item_list); //[226] $minimum_items_per_page; //[30] $pages = ($item_count/$minimum_items_per_page); //[7] $remainder = $item_count % $minimum_items_per_page; //[16] $remPerPage = round($remainder/$pages); //[2] $remain2 = ($remainder % $pages); //[2] $limit = $minimum_items_per_page + $remPerPage; //[32] $outcome = array(); $offset = 0; for ($i = 1; $i < $pages; $i++) { if($remain2 => 0) { $limit += 1; $remain2 -= 1; } /*for ($i2 = $offset; $i2 < $offset + $limit; $i2++) { print($item_list[$i2]."<br>"); }*/ $outcome[] = array("offset" => ($offset), "limit" => ($limit)); $offset += $limit; } print_r($outcome); } ?>

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)
7.0.100.4530.07719.98
7.0.90.0200.07719.95
7.0.80.0270.06319.94
7.0.70.0430.07720.00
7.0.60.0430.05720.05
7.0.50.9600.06720.33
7.0.40.9170.05720.21
7.0.30.0130.07020.37
7.0.21.9870.06314.11
7.0.10.8000.07320.43
7.0.00.7930.05720.31
5.6.250.0030.09720.82
5.6.240.0300.06020.68
5.6.230.0100.06720.77
5.6.220.0070.0036.30
5.6.210.0200.07020.80
5.6.200.0130.07321.23
5.6.190.0100.07721.15
5.6.180.0130.07721.18
5.6.170.0170.06321.13
5.6.160.0100.06321.24
5.6.150.0100.07021.17
5.6.140.0130.06321.24
5.6.130.0170.05721.24
5.6.120.0230.06021.21
5.6.110.0070.07021.21
5.6.100.0030.08021.09
5.6.90.0070.06321.12
5.6.80.0130.07720.48
5.6.70.0270.05320.44
5.6.60.0170.07020.57
5.6.50.0070.07720.60
5.6.40.0070.06020.54
5.6.30.0270.06320.54
5.6.20.0170.06720.54
5.6.10.0230.06720.48
5.6.00.0100.07320.41

preferences:
138.12 ms | 1446 KiB | 7 Q