I want to do something with PHP arrays. I wrote a function to do something which I will say. My input array is:
Array
(
[0] => stdClass Object
(
[message] => Automated XML Site Map Generator
http://pastebin.com/xjJe38dp
[id] => 103114753133019_371405176303974
[from] => stdClass Object
(
[id] => 735588533186829
[name] => Mohammad Mostafa Shahreki
)
[created_time] => 2013-04-26
[updated_time] => 2013-04-26
)
[1] => stdClass Object
(
[message] => Simple but powerful DB class
http://pastebin.com/1qgxUrwX
[id] => 103114753133019_371404696304022
[from] => stdClass Object
(
[id] => 735588533186829
[name] => Mohammad Mostafa Shahreki
)
[created_time] => 2013-04-26
[updated_time] => 2013-04-26
)
[2] => stdClass Object
(
[message] => Convert Existing DB to Unicode
http://pastebin.com/pHu08cPs
[id] => 103114753133019_371404609637364
[from] => stdClass Object
(
[id] => 735588533186829
[name] => Mohammad Mostafa Shahreki
)
[created_time] => 2013-04-26
[updated_time] => 2013-04-26
)
[3] => stdClass Object
(
[message] => thanks mosthafa ,,,, for adding me to this group
[id] => 103114753133019_103333343111160
[from] => stdClass Object
(
[id] => 10155092057165556
[name] => HalF PixeL
)
[created_time] => 2011-10-11
[updated_time] => 2011-11-21
)
)
I want to save each data in my MySQL database. For example I want to save message,id,from->name,created_time by a function. I tried to write a foreach loop but I couldn't find a way to add from->name, it's a stdClass and can't use it with ['from']['name']. could you tell me how I can do this?