php iterate over object key values code example Example: php loop through class properties foreach ($obj as $key => $value) { echo "$key => $value\n"; }