sublevel4 Posted July 17, 2012 Share Posted July 17, 2012 I have the following code $response = $bc->getProjects(); // iterate the projects foreach($response['body']->project as $project){ print_r($project[$n]->name); print_r($project[$n]->company->name); echo '<br>__________________________________<br>'; $n++; } That gives me this output SimpleXMLElement Object ( [0] => Dancing ) SimpleXMLElement Object ( [0] => Marketing ) <br>__________________________________<br> How do i get rid of the SimpleXMLElement Object in the output? Link to comment https://forums.phpfreaks.com/topic/265859-simplexml/ Share on other sites More sharing options...
Maq Posted July 17, 2012 Share Posted July 17, 2012 Just echo them out: echo $project[$n]->name; echo $project[$n]->company->name; Read: http://php.net/manual/en/function.print-r.php Link to comment https://forums.phpfreaks.com/topic/265859-simplexml/#findComment-1362280 Share on other sites More sharing options...
requinix Posted July 17, 2012 Share Posted July 17, 2012 Use them in any way that treats the values as strings. Like with echo, or strval(), or a typecast to string, or interpolated in a string, or most of the str*() functions, or lots of other ways. Link to comment https://forums.phpfreaks.com/topic/265859-simplexml/#findComment-1362306 Share on other sites More sharing options...
sublevel4 Posted July 18, 2012 Author Share Posted July 18, 2012 Ah, i see the error in my ways. Thanks you for the help! Link to comment https://forums.phpfreaks.com/topic/265859-simplexml/#findComment-1362403 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.