You are here: iterating through object structure « PHP Programming Language « IT news, forums, messages
iterating through object structure

Posted by JamesG on 10/31/07 15:05

Hi,

I have a data structure as follows (print_r($data)):

Array
(
[0] => stdClass Object
(
[FIELD1] => 2355
[FIELD2] => 123
[FIELD3] => 1.25
)

[1] => stdClass Object
(
[FIELD1] => 309
[FIELD2] => 122
[FIELD3] => 0.55
)

)

I can't seem to iterate through it,

If I try
foreach($data as $obj) {
echo $obj->FIELD1 + $obj->FIELD2;
}

It only shows the first object, not the rest. What am I doing wrong?
Thanks

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация