note 55341 deleted from function.range by nlopess
| From: | nlopess@php.net | Date: | Sun, 08 Jan 2006 14:53:49 +0000 |
| Subject: | note 55341 deleted from function.range by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-101411@lists.php.net to get a copy of this message | ||
Note Submitter: jw at jwscripts dot com
----
The step parameter can be applied to produce arrays with even or odd numbers only:
<?php
// Range 1..10
print_r(range(1,10));
// Range 1..10, odd numbers only
print_r(range(1,10,2));
// Range 1..10, even numbers ony
print_r(array_diff(range(1,10), range(1,10,2)));
?>