note 15139 added to function.sort

From: Date: Wed, 29 Aug 2001 14:11:33 +0000
Subject: note 15139 added to function.sort
Groups: php.notes 
Request: Send a blank email to php-notes+get-17300@lists.php.net to get a copy of this message
Note that sort() is void, so an assignment like $foo_array = sort( $foo_array ); wont work. In result you cannot combine sort() for use with other array-related functions just like array_unique() or array_values(). None of the following statements works: sort( array_unique( $foo_array ) ); // returns empty string $foo_array = array_unique( sort( $foo_array) ); // returns parameter failure The only way to combine those functions is to apply sort() in a single line statement. So please dont waste your time with hours of debugging like me before I found out, its void... ;-) http://php4.globe.de/manual/en/function.sort.php

« previous php.notes (#17300) next »