Skip to content

Instantly share code, notes, and snippets.

@blar
Created March 15, 2014 18:20
Show Gist options
  • Select an option

  • Save blar/9571635 to your computer and use it in GitHub Desktop.

Select an option

Save blar/9571635 to your computer and use it in GitHub Desktop.
<?php
$m = 3;
$array = array_filter(range(23, 42), function($value, $index) use($m) {
return $index % $m == 0;
}, ARRAY_FILTER_USE_BOTH);
var_dump($array);
array(7) {
[0]=>
int(23)
[3]=>
int(26)
[6]=>
int(29)
[9]=>
int(32)
[12]=>
int(35)
[15]=>
int(38)
[18]=>
int(41)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment