[PHP] complex array
Is there an easier, quicker way to access the values in this array returned from a SOAP request? This is the result of my print_r() :Array ( [0] => Array ( [name] => [description] => y [members] => Array ( [0] => Array ( [group] => abc) [1] => Array ( [group] => cdf ) ) ) [1] => Array ( [name] => kk[description] => bbb [members] => Array ( [0] => Array ( [group] => jkl ) [1] => Array ( [group] => lmn ) [2] => Array ( [group] => Mnop ) ) ) )Currently, I to access the members array, I have to do this: foreach($result as $rows) { foreach ($rows as $key=>$val) { #print "$key = $val }foreach ($rows[members] as $row2) { foreach ($row2 as $key2=>$val2) {print "$key2 = $val2 }}}Thanks,Chhai -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] complex array
Thanks Torsten! It works fine. Regards, Chhai <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Chhai T <[EMAIL PROTECTED]> schrieb am 05.05.2004, 09:55:25: > > Is there an easier, quicker way to access the values in this array returned > > from a SOAP request? This is the result of my print_r() :Array > > ( > > [0] => Array > > ( > > [name] => [description] => y > > [members] => Array > > ( > > [0] => Array > > ( > > [group] => abc) > > > > [1] => Array > > ( > > [group] => cdf > > ) > > > > ) > > > > ) > > > > [1] => Array > > ( > > [name] => kk[description] => bbb > > [members] => Array > > ( > > [0] => Array > > ( > > [group] => jkl > > ) > > > > [1] => Array > > ( > > [group] => lmn > > ) > > > > [2] => Array > > ( > > [group] => Mnop > > ) > > > > ) > > > > ) > > > > )Currently, I to access the members array, I have to do this: > > foreach($result as $rows) > > { > > foreach ($rows as $key=>$val) > > { > > #print "$key = $val > >}foreach ($rows[members] as $row2) > > { > > foreach ($row2 as $key2=>$val2) {print "$key2 = > > $val2 > >}}}Thanks,Chhai > > What about this: > > $count = count($result); > for ($i = 0; $i < $count; $i++) { > > $tempCount = count($result[$i]['members']); > for ($k = 0; $k < $tempCount; $k++) { > > echo $result[$i]['members'][$k]['group']; > } > } > > This should output the groups. Heven't tested it, though. > > Regards, Torsten -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: remove soap header
What are you using to access the soap server? If you use the modules such as NuSOAP or SOAP built in for PHP5 you wouldn't have to worry about the response header. Chhai "Diana Castillo" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Any ideas how to remove the soap header from the xml response? > > -- > Diana Castillo > Global Reservas, S.L. > C/Granvia 22 dcdo 4-dcha > 28013 Madrid-Spain > Tel : 00-34-913604039 > Fax : 00-34-915228673 > email: [EMAIL PROTECTED] > Web : http://www.hotelkey.com > http://www.destinia.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php