My host is using an old version of php 5.2 which gives me parse errors because of this piece of code listing, suggestions on how to make it version 5.2 compatible in the mean time, it works well in my local server which is version 5.3
function getRequestedTests($labref) {
$this->db->select('name');
$this->db->from('tests t');
$this->db->join('request_details rd', 't.id=rd.test_id');
$this->db->where('rd.request_id', $labref);
$this->db->order_by('name', 'desc');
$query = $this->db->get();
$result = $query->result();
//problem starts here with the array_map()
$output = array_map(function ($object) {
return $object->name;
}, $result);
return $tests = implode(', ', $output);
}
function my_arr_map($object) {
return $object->name;
}
function getRequestedTests($labref) {
$this->db->select('name');
$this->db->from('tests t');
$this->db->join('request_details rd', 't.id=rd.test_id');
$this->db->where('rd.request_id', $labref);
$this->db->order_by('name', 'desc');
$query = $this->db->get();
$result = $query->result();
//problem starts here with the array_map()
$output = array_map(array($this, 'my_arr_map'), $result);
return $tests = implode(', ', $output);
}