Flag the last element of an array


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. $keys = array_keys($array);
  2. if(!empty($keys)) {
  3. $last_key = array_pop($keys);
  4. $array[$last_key]['isLast'] = true;
  5. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.