Wachisu

kek

Dec 25th, 2015
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.23 KB | None | 0 0
  1. $nArr = array("key1" => "val1", "key2" => "val2");
  2. $count = 0;
  3. foreach ( $nArr as $key => $singleValue ) {
  4.     // do something with the value/key
  5.     $count++; // add 1 to the count every time we go trough one loop
  6. }
  7.  
  8. echo $count; // "2"
Advertisement
Add Comment
Please, Sign In to add comment