Advertisement
Guest User

Untitled

a guest
Jan 4th, 2016
527
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.27 KB | None | 0 0
  1. // the same "$fruit" array with your own numbered keys
  2. $fruit = array(10=>'orange', 11=>'cherry', 12=>'lemon');
  3.  
  4. // add the apple on #3
  5. $fruit[2] = 'apple'; // Note, the first array element has a zero as key
  6.  
  7. foreach ($fruit as $key => $val) {
  8.     echo "$key - $val<br>";
  9. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement