SyntaxFix
Write A Post
Hire A Developer
Questions
If you have PHP 5.5 or later, the best way is to use the built in function array_column():
array_column()
$idCats = array_column($cats, 'id');
But the son has to be an array or converted to an array