Bug #11524: shifting or popping array with leading or trailing empty elements
| From: | jmroth at iip dot lu | Date: | Sun, 17 Jun 2001 22:32:12 +0000 |
| Subject: | Bug #11524: shifting or popping array with leading or trailing empty elements | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-56779@lists.php.net to get a copy of this message | ||
From: jmroth@iip.lu
Operating system: Linux 2.2.16
PHP version: 4.0.5
PHP Bug Type: Arrays related
Bug description: shifting or popping array with leading or trailing empty elements
Let's say I have this string:
/FAQ/
(a URI, actually)
An explode action (delim is /)with a resulting count of the array reveals 3 elements.
After an array_shift or array_pop, the count goes to 1. 3-1=1?
$uri =
strtolower(preg_replace("/[^a-zA-Z0-9\/]/","",$HTTP_SERVER_VARS["REQUEST_URI"]));
$uri = explode("/", $uri); // make it an array
echo count($uri);
$uri = array_shift($uri); // delete first value which is always empty
echo count($uri);
--
Edit Bug report at: http://bugs.php.net/?id=11524&edit=1