Get property names from PHP stdClass
问题 I have an array object that looks like: $inDatabase = Array ( [0] => stdClass Object ( [abc@gmail.com] => Array ( ) ) [1] => stdClass Object ( [xyz@gmail.com] => Array ( ) ) ) How do I push email addresses onto a new array? I tried the following: $innerKeys =[]; $temp=[]; for($i=0;$i<2;$i++){ $temp = array_keys($inDatabase[$i]) //so I thought $temp[0] would have the email address but $temp is null. array_push($innerKeys,$temp[0]); } 回答1: array_keys() is for arrays. To turn the object