While working on some code today, I found that the following will work in 5.3, but not before.
<?php
class Test{
public function uasort(){
$array = array( 'foo' => 'bar', 123 => 456 );
uasort( $array, 'self::uasort_callback' );
return $array;
}
static private function uasort_callback( $a, $b ){
return 1;
}
}
$Test = new Test;
var_dump( $Test->uasort() );
It’s just curious what this function is called and whether it considers itself a good, bad (or sloppy) practice, changing it to
uasort( $array, 'Test::uasort_callback' );
works fine in 5.2 as well.
source
share