From:             [EMAIL PROTECTED]
Operating system: linux, windows
PHP version:      4.0.6
PHP Bug Type:     Feature/Change Request
Bug description:  sort functions

$test[0] = 0;
$test[1] = 1;
$test[2] = 2;
asort($test);

I hate this, a function should never modify a variable, it should return
the new modified variable. they syntax should be

$test = asort($test);

there are good reasons or this. I hate needing a variable sorted for one
command and having to make a temp var just todo that.

$tmp = $test;
asort($tmp);
foreach( $tmp as $pos => $val )

where it could be.

foreach( asort($test) as $pos => $val )

saves time and ledgibility. I understand its not easy to change the syntax
now. if you wanted to make some work or yourself you could make this a
php.ini option. if you want something simpler on your end, just make a new
set of functions, thats what Ive done.

function my_asort($array)
{
  asort($array);
  return $array);
}

even if you dont want to ever include this into base php, at least make
asort return the newly modified variable.

$tmp = $test;
foreach( asort($tmp) as $pos => $val )

  Chris Lee
  [EMAIL PROTECTED]
-- 
Edit bug report at: http://bugs.php.net/?id=13825&edit=1


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to