On 21/06/10 00:45, Rick Pasotto wrote:
Within a class function I have defined another function for use with the
usort() function. How do I reference it?
When it's not part of a class usort($arr,"cmp") works fine but when it's
within a class function I get this error:
PHP Parse error: syntax error, unexpected T_STRING, expecting T_FUNCTION
Is it not in the scope of the class function?
you need to use an array to describe the callback function:
public function cmp($a,$b)
// do comparison and return result
$foo = new Foo();
I think that's right - doesn't the manual describe this sort of thing about
using callback functions that are class members?
Peter Ford, Developer phone: 01580 893333 fax: 01580 893399
Justcroft International Ltd. www.justcroft.com
Justcroft House, High Street, Staplehurst, Kent TN12 0AH United Kingdom
Registered in England and Wales: 2297906
Registered office: Stag Gates House, 63/64 The Avenue, Southampton SO17 1XS
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php