Converting code with Anonymous functions to PHP 5.2

makedon

New Member
I have some PHP 5.3 code which builds an array to be passed to a view. This is the code I have.\[code\]# Select all this users links.$data = http://stackoverflow.com/questions/3809405/$this->link_model->select_user_id($this->user->id);if (count($data) > 0) { # Process the data into the table format. $table = array ('properties' => array ( 'delete_link_column' => 0, ), 'callbacks' => array ( # Callback for the name link. function($value) { return sprintf('<a href="http://stackoverflow.com/links/view/name/%s">%s</a>', $value, $value); }, # Callback for the category link. function($value) { return sprintf('<a href="http://stackoverflow.com/category/view/name/%s">%s</a>', $value, $value); }, # Callback for the creation date. function($value) { return date('jS M Y', $value); }, # Callback for the delete link. function($value) { return sprintf('<a href="http://stackoverflow.com/questions/3809405/links/delete/name/%s">delete</a>', $value); }, ), 'columns' => array ( 'name', 'category', 'creation date', ), 'data' => array ( ), 'sorting' => array ( 'sort' => false, ), );\[/code\]However the problem is that I cannot use anonymous functions in PHP 5.2, which is the server I must upload this schoolwork. The view requires callback functions to be defined so it can call them.What would be the neatest way to convert this PHP code to not using anonymous functions? Thanks.
 
Back
Top