razorsese Posted April 21, 2012 Share Posted April 21, 2012 I need to return a specific key from the object converted to array but it seems that it dosent work $toarray = (array)$tmp; $name = array_keys($toarray,'name'); print_r($toarray); print:Array ( [id] => 9 [name] => dfd [text] => fdsf [rating] => 0 [totalv] => 0 ) and when i try to return the key print_r($name); Array ( [0] => rating [1] => totalv ) But I only need the key whit the 'name' value Quote Link to comment https://forums.phpfreaks.com/topic/261380-php-object-to-array-then-return-key/ Share on other sites More sharing options...
cpd Posted April 21, 2012 Share Posted April 21, 2012 Edit Quote Link to comment https://forums.phpfreaks.com/topic/261380-php-object-to-array-then-return-key/#findComment-1339385 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.