Reply to Re: How to extract from array

Your name:

Reply:


Posted by Rami Elomaa on 05/15/07 15:07

harvey kirjoitti:
> What is the easiest way to get both the last item name and last item
> value from an associative array?
>
> I can get the value with array_pop() but can't see anything similar
> for the item's name.
>

$val_last = end($array);
// Sets the internal pointer to last element while it retuns the value

$key_last = key($array);
// Returns the key of the element the internal pointer is at


--
Rami.Elomaa@gmail.com

"Wikipedia on vähän niinq internetin raamattu, kukaan ei pohjimmiltaan
usko siihen ja kukaan ei tiedä mikä pitää paikkansa." -- z00ze

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация