Skip to content

Instantly share code, notes, and snippets.

@binaryoung
Created August 20, 2018 08:53
Show Gist options
  • Save binaryoung/4c9dc945ba0fc1c13c7137adb18d308b to your computer and use it in GitHub Desktop.
Save binaryoung/4c9dc945ba0fc1c13c7137adb18d308b to your computer and use it in GitHub Desktop.
big data array pagination
<?php
define('START', microtime(true));
define('START_MEMORY', memory_get_peak_usage(true));
collect(range(0, 1000000))->slice(500000)->forPage(3,20);
define('END', microtime(true));
define('END_MEMORY', memory_get_peak_usage(true));
echo END - START,',',END_MEMORY - START_MEMORY;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment