how to iterate through key value pairs in php code example Example: loop over keys and values php foreach ($arr as $key => $value) { echo $key; }