<?php $x = new stdclass ; $x -> { "42" } = 1337 ; $x = ( array ) $x ; foreach ( $x as $key => $value ) { if ( ! array_key_exists ( $key , $x )) echo 'lolphp' ; } ?>