PHP 4.0 Bug #9633: sort() not working
| From: | sgarin at sgarin dot com | Date: | Thu, 08 Mar 2001 18:43:59 +0000 |
| Subject: | PHP 4.0 Bug #9633: sort() not working | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-48299@lists.php.net to get a copy of this message | ||
From: sgarin@sgarin.com
Operating system: Linux RH6.2 -> 2.2.18
PHP version: 4.0.4pl1
PHP Bug Type: Unknown/Other Function
Bug description: sort() not working
I have an array with random number of elements. I analyse each value (by random selection) and unset
it after. In one case, If I unset the first element of my array with 2 elements, sort function does
not slide value of the second element to the first element. (sorry for my english).
Exemple :
<?PHP
$tb = array (5, 18, 11);
echo "Values: [0]=$tb[0] [1]=$tb[1] [2]=$tb[2]<BR>";
unset ($tb[0]);
echo "After unset: [0]=$tb[0] [1]=$tb[1] [2]=$tb[2]<BR>";
sort ($tb);
echo "After sort: [0]=$tb[0] [1]=$tb[1] [2]=$tb[2]<BR>";
unset ($tb[0]);
echo "After unset: [0]=$tb[0] [1]=$tb[1]<BR>";
sort ($tb);
echo "After sort: [0]=$tb[0] [1]=$tb[1]";
?>
I resolved this trouble by calling implode and explode functions.
--
Edit Bug report at: http://bugs.php.net/?id=9633&edit=1