@ 2016-09-07T22:00:51Z <?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);
}
?>
Enable javascript to submit You have javascript disabled. You will not be able to edit any code.
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).
Version System time (s) User time (s) Memory (MiB) 7.0.10 0.453 0.077 19.98 7.0.9 0.020 0.077 19.95 7.0.8 0.027 0.063 19.94 7.0.7 0.043 0.077 20.00 7.0.6 0.043 0.057 20.05 7.0.5 0.960 0.067 20.33 7.0.4 0.917 0.057 20.21 7.0.3 0.013 0.070 20.37 7.0.2 1.987 0.063 14.11 7.0.1 0.800 0.073 20.43 7.0.0 0.793 0.057 20.31 5.6.25 0.003 0.097 20.82 5.6.24 0.030 0.060 20.68 5.6.23 0.010 0.067 20.77 5.6.22 0.007 0.003 6.30 5.6.21 0.020 0.070 20.80 5.6.20 0.013 0.073 21.23 5.6.19 0.010 0.077 21.15 5.6.18 0.013 0.077 21.18 5.6.17 0.017 0.063 21.13 5.6.16 0.010 0.063 21.24 5.6.15 0.010 0.070 21.17 5.6.14 0.013 0.063 21.24 5.6.13 0.017 0.057 21.24 5.6.12 0.023 0.060 21.21 5.6.11 0.007 0.070 21.21 5.6.10 0.003 0.080 21.09 5.6.9 0.007 0.063 21.12 5.6.8 0.013 0.077 20.48 5.6.7 0.027 0.053 20.44 5.6.6 0.017 0.070 20.57 5.6.5 0.007 0.077 20.60 5.6.4 0.007 0.060 20.54 5.6.3 0.027 0.063 20.54 5.6.2 0.017 0.067 20.54 5.6.1 0.023 0.067 20.48 5.6.0 0.010 0.073 20.41
preferences:dark mode live preview
138.12 ms | 1446 KiB | 7 Q