[PHP-DEV] PHP 4.0 Bug #9633 Updated: sort() not working From: andre <email protected>
Date: 03/09/01

ID: 9633
Updated by: andre
Reported By: sgarin <email protected>
Old-Status: Open
Status: Bogus
Bug Type: Unknown/Other Function
Assigned To:
Comments:

bogus,
try using var_dump() on $tb to figure out what happens,
sort() is fine indeed...

Previous Comments:
---------------------------------------------------------------------------

[2001-03-08 13:43:59] sgarin <email protected>
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.

---------------------------------------------------------------------------

ATTENTION! Do NOT reply to this email!
To reply, use the web interface found at http://bugs.php.net/?id=9633&edit=2

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: php-dev-unsubscribe <email protected>
For additional commands, e-mail: php-dev-help <email protected>
To contact the list administrators, e-mail: php-list-admin <email protected>