how can I remove empty object from array in php? json code
You can use my code in bottom :
print_r(array_filter($linksArray));
You can use built in function array_filter(); http://php.net/manual/en/function.array-filter.php
Use array_filter like this, to check empty object, you can convert it to array, then check the length of the array.
array_filter($objects, function($v){return count((array)$v) > 0;});