usort to a Object

From: Date: Wed, 11 Oct 2000 08:37:28 +0000
Subject: usort to a Object
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-19584@lists.php.net to get a copy of this message
I have a Object ups: class b { var name; function b($na) { $this->name=$va; } ....... } class ups { var MiArray = Array(); function ups() { array_push(new b("Juan")); array_push(new b("Carlos")); } function sort_me() { echo "sort_me"; usort($this->MiArray,$this->sort_user); <-- I think that the error is here } function sort_user($a,$b) { ---- HERE Don`t enter echo "Sorting... "; return (strcmp($a->name,$b->name)?-1:1); } } the sort_user is not executed when the $this->sort_me(); if i put sort_user out of the UPS class and in sort_me --> usort($this->MiArray,sort_user) <-- my class run. Juan Carlos Sanz juanrak@svalero.es Necesita aprender ingles, ya lo se.

« previous php.general (#19584) next »