Using Anonymous Function Doesn't Give Expected Result.

Dear all,

I have encountered a problem on using anonymous function as a callback in Yii. Briefly speaking, I have a piece of code in the "component" folder that looks like:

class MyClass {

  public function test() {

    $array = array( array('a', 1), array('b', 2) );

    $myComparator = function ($a, $<img src='' class='bbc_emoticon' alt='B)' />  {

	if ($a[1] == $b[1]) return 0; else if ($a[1] > $b[1]) return -1; else return 1; 


    usort($array, $myComparator);	

    return $array;



When I accessed this method from a standard controller, in which I just var_dump-ed the return value to the browser window, I receive no output at all. But if I accessed it without touching Yii framework (such as invoking it in a terminal) I obtained the expected sorted array. There was no error message both cases.

I couldn’t figure out why in my Yii environment the anonymous function doesn’t work right. I have searched in the forum, and noticed that the only relevant post to this issue said “The current framework is compatible with PHP 5.2 and so can’t use anonymous functions. 2.0 will be PHP 5.3+ though.”. If this is correct, may someone clarify with a official link please? Or may anyone leave me some hints about the problem?

Many thanks in advance!

P.S. I am using Yii-1.1.8 with PHP 5.3.17.

Sorry I have posted to the wrong section by mistake.