Anonymous Function For Php 5.2

Hello guys,

I have the problem that my provider is using PHP 5.2 so anonymous function are not working there, this is my code but I am struggling to fix it. Please let me know if you can help me. THanks

$columns = array(





				'value'=>function ($data) {

							$arr = array();

							$arr = array_keys($data->rel_media(array('index' => 'filename')));

							if (!empty($arr))


							$result = CHtml::image(Yii::app()->request->baseUrl.'/images/product/'.$data->id_product.'/'.$arr[0],'',array('style'=>'width:48px;height:48px;'));

							return $result ;







What is the error / exception?


You may want to post this in Yii 1.x forum to get better response. This is forum for Yii 2 (and Yii 2 supports PHP 5.4 and above).

IMO… you need to upgrade your host to use latest PHP version and get better features.

The hosting told me that they will not upgrade to PHP 5.3.

This is the error that I got:

Parse error: syntax error, unexpected T_FUNCTION in \protected\controllers\ProductController.php on line 394

Solved using this forum:

thanks !