3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = Array ( "states" => Array ( "" => "Select State", "1" => "Andaman and Nicobar (AN)", "2" => "Andhra Pradesh (AP)")); echo "<pre>"; print_r($array ); end($array['states']); // move the pointer to the end of the array $key = key($array['states']); // get the last key $value = $array['states'][$key]; //// get last value be key echo 'Last key '.$key.'and last value '. $value ; ?>
Output for git.master, git.master_jit, rfc.property-hooks
<pre>Array ( [states] => Array ( [] => Select State [1] => Andaman and Nicobar (AN) [2] => Andhra Pradesh (AP) ) ) Last key 2and last value Andhra Pradesh (AP)

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
132.34 ms | 406 KiB | 5 Q