Skip to content

Instantly share code, notes, and snippets.

@amitittyerah
Created March 24, 2014 00:49
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save amitittyerah/9732300 to your computer and use it in GitHub Desktop.
Save amitittyerah/9732300 to your computer and use it in GitHub Desktop.
array_chunk($arr, $size) version of Python
def array_chunk(arr, size):
chunks=[arr[x:x+size] for x in xrange(0, len(arr), size)]
@fxpires
Copy link

fxpires commented Jun 4, 2018

Isn't the code lacking a "return chunks" line?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment