Get the final key of an array in PHP

Posted by GSto on Stack Overflow See other posts from Stack Overflow or by GSto
Published on 2010-06-11T17:25:57Z Indexed on 2010/06/11 19:12 UTC
Read the original article Hit count: 138

Filed under:
|

I have a standard associative array in PHP. what's the simplest way to get the last key in that array?

example:

$foo = array('key1' => 'val1', 'key2' => 'val2', 'key3' => 'val3');

and i would like to get 'key3';

© Stack Overflow or respective owner

Related posts about php

Related posts about arrays