Concatenate some Array Elements among many in PHP -
I have an array "$ abc" which has 9 elements, such as: -
Array ([A] => Jack [B] => went away [C] => above [D] => [E] => Hill [F] = & gt; But [g] => now [i] => came [i] => back)
Now start with the "e" index from "b" index There are only 4 elements that need to be included. But I do not know what to do. I use the PHP "implode ()" function in those cases where all the array elements are added.
Any help is greatly appreciated.
You must first remove the desired value and then use implode
. You can use it:
Echo Flat ("", ARR_slice ($ ABC, 1, 4));
This will be generated on the hill climax
.
If you need to work with a literal key, then you should be a little more creative. In your case, it would probably be best to loop through the array, but you can do some foreign too:
Echo Flat ("", array_intersect_key ($ abc, array_flip (category ( 'B', 'E'))));
Comments
Post a Comment