note 42441 added to function.range

From: Date: Mon, 17 May 2004 02:22:36 +0000
Subject: note 42441 added to function.range
Groups: php.notes 
Request: Send a blank email to php-notes+get-69682@lists.php.net to get a copy of this message
A mistake in my previous post...I accidently used native C syntax. Fixed: function myRange($low,$high,$step='1') { $ranArray = range($low,$high); $step--; $keys = count($ranArray); for($i=0;$i<$keys;$i++) { $retArray[] = $ranArray[$i]; $i = $i + $step; } return $retArray; } // usage: myRange(low,high, ... [optional step]); // example: print_r(myRange(1,11,2)); // output: // Array ( // [0] => 1 // [1] => 3 // [2] => 5 // [3] => 7 // [4] => 9 // [5] => 11 // ) Sorry about that :) ---- Manual Page -- http://www.php.net/manual/en/function.range.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+42441 Delete -- http://master.php.net/manage/user-notes.php?action=delete+42441&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+42441&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#69682) next »