I have a PHP code which runs on PHP7 but not in PHP 5, which PHP version in my server, that is my code:
Array (
[0] => stdClass Object (
[userId] => 15
[name] => name0
[userName] => hh
[centerName] => center10
)
[1] => stdClass Object (
[userId] => 16
[name] => name1
[userName] => test
[centerName] => center10
)
[2] => stdClass Object (
[userId] => 1
[name] => name2
[userName] => ll
[centerName] => center1
)
)
$ids = array_unique(array_column($results, 'centerName'));
print_r($ids);
I get what I expected in PHP7 but I get an empty array in PHP5.
How can I adapt my code to work in PHP5?