All I need to two is remove the final two elements from an array, which only contains 3 elements, output those two removed elements and then output the non-removed element. I’m having trouble removing the two elements, as well as keeping their keys.
My code is here http://pastebin.com/baV4fMxs
It is currently outputting : Java
Perl
Array
I want it to output:
[One] => Perl and [Two] => Java
[Zero] => PHP
It seems to me that you want to retrieve those two values being removed before getting rid of them. With this in mind, I suggest the use of
array_pop()which simultaneously returns the last item in the array and removes it from the array.