Hello Readers, If you want to implode the array keys from multi-dimensional array then now PHP 5.5 offers you much easier way to do this.
Lets see the example as below:-
Array
(
    [0] => Array
        (
            [studenID] => 54874
            [City] => New Delhi
            [Marks] => 256
            [School] => 2
        )
    [1] => Array
        (
            [studenID] => 54875
            [City] => Mumbai
            [Marks] => 159
            [School] => 6
        )
)
Now suppose you want the result as New Delhi, Mumbai
Now by using PHP V5.5 you just have to write this code syntax:-
echo implode(', ', array_column($array, 'City'));
Where $array is the name of array and City is my key.
                       
                    
0 Comment(s)