iteration in foreach php code example Example: php loop through objects foreach ($obj as $key => $value) { echo "$key => $value\n"; }