The following warnings occurred:
Warning [2] Undefined array key 0 - Line: 1669 - File: showthread.php PHP 8.2.28 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/showthread.php 1669 errorHandler->error_callback
/showthread.php 915 buildtree




Brain tickler if you're bored
#29
JackoliciousLegs Wrote:Nobody could get it eh? Well, here are the two solutions I have:

With ternary
$cur_pagesize = ($cur_page * $pagesize > $total_results) ? ($total_results % $pagesize) : $pagesize;

Without
$cur_pagesize = ($pagesize + (floor($cur_page / ceil($total_results / $pagesize))) * (($total_results % pagesize) - $pagesize));

floor and ceil are FUNCTIONS, you didn't say you had access to FUNCTIONS!!! God that's slower than the ternary
  Reply


Messages In This Thread

Forum Jump: