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(

			array(

				'name'=>'id_media',

				'header'=>Yii::t('strings','Media'),

				'type'=>'html',

				'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 ;

							}

							}

							),

							'title',

array('class'=>'CButtonColumn')

	);



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: http://www.yiiframework.com/forum/index.php/topic/39862-problem-with-cgridview-and-anonymous-function/page__p__190928__hl__anonymou+function#entry190928

thanks !