note 26712 rejected from function.intval by maxim
| From: | maxim@php.net | Date: | Sun, 10 Nov 2002 04:40:18 +0000 |
| Subject: | note 26712 rejected from function.intval by maxim | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-39252@lists.php.net to get a copy of this message | ||
To my surprise
$k = "0,100 32,200 66,300 77,1000";
$arr = preg_split('/ /', $k, -1, PREG_SPLIT_NO_EMPTY);
foreach ($arr as $a) {
list($h, $w) = split(',', $a);
print "$h, ". 1 + intval($w) ." ";
}
Why I get "100 200 300 1000"?
(print "$h, $w"; and $x = $w + 1; print "$h $x"; works fine).