note 100234 added to function.range
| From: | amxm at ya dot ru | Date: | Sun, 03 Oct 2010 11:48:14 +0000 |
| Subject: | note 100234 added to function.range | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-172907@lists.php.net to get a copy of this message | ||
input: array (0,1,2,3,11,12,13,14);
output: 0-3,11-14
/**
* Range View
*
* Maxim Arnautov 2010
*/
function range_view($array){
$start=false;
foreach ($array as $key => $h){
if ($start===false) {
$start=$h;
continue;
}
if ($start!==false AND $h==($array[$key+1]-1)) continue;
elseif ($start!==false) {
$hw.="{$start}-{$h},";
$start=false;
}
}
$hw = trim($hw,',');
return $hw;
}
----
Server IP: 69.147.83.197
Probable Submitter: 78.106.199.76
----
Manual Page -- http://www.php.net/manual/en/function.range.php
Edit -- https://master.php.net/note/edit/100234
Del: integrated -- https://master.php.net/note/delete/100234/integrated
Del: useless -- https://master.php.net/note/delete/100234/useless
Del: bad code -- https://master.php.net/note/delete/100234/bad+code
Del: spam -- https://master.php.net/note/delete/100234/spam
Del: non-english -- https://master.php.net/note/delete/100234/non-english
Del: in docs -- https://master.php.net/note/delete/100234/in+docs
Del: other reasons-- https://master.php.net/note/delete/100234
Reject -- https://master.php.net/note/reject/100234
Search -- https://master.php.net/manage/user-notes.php