-3

I am having problem finding the last record from an array in cakephp. Please suggest me a proper way to find out the last entry from the array.

Costa
  • 4,851
  • 33
  • 30
  • possible duplicate of [get last value in array](http://stackoverflow.com/questions/3801891/get-last-value-in-array) – ndm Aug 04 '14 at 15:30
  • 'PassportDetail' => array( (int) 0 => array( 'id' => '3', 'iso_countrylist_id' => '154', 'passport_number' => 'gdfgdfsgfdg', 'issue_date' => '2014-07-25', 'expiry_date' => '2014-07-25', 'basic_info_id' => '12', 'IsoCountrylist' => array( 'title' => 'NEPAL' ) ), (int) 1 => array( 'id' => '4', 'iso_countrylist_id' => '1', 'passport_number' => '11111111111', 'issue_date' => '2014-08-02', 'expiry_date' => '2014-08-02', 'basic_info_id' => '12', 'IsoCountrylist' => array( 'title' => 'AFGHANISTAN' ) ) ), I need to echo afghanistan – Tikaram Bhandari Aug 04 '14 at 15:39

1 Answers1

2

Same as any other array:

$result = end($array);
AbraCadaver
  • 78,200
  • 7
  • 66
  • 87