Skip to content

Instantly share code, notes, and snippets.

@qwhex
Created December 9, 2016 00:07
Show Gist options
  • Save qwhex/4f7a343dd06047b4351a8480a665e65c to your computer and use it in GitHub Desktop.
Save qwhex/4f7a343dd06047b4351a8480a665e65c to your computer and use it in GitHub Desktop.
PHP array comprehension like Python list comprehensions
<?php
array_map(function($x) {return $x*$x;}, range(0, 9))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment