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