Ok, so I'm requesting state and city from a service using SOAP and using a 'foreach' loop to output the states, and within each of those iterations, I'm using another 'foreach' loop to output the cities within each state.First, the SOAP call:\[code\]$client = new SoapClient("https://devxml.#####.com/golfService.asmx?wsdl", array('features' => SOAP_SINGLE_ELEMENT_ARRAYS));$regionList = $client->Areas( array( 'Hdr' => array( 'ResellerId' => '#####', 'SourceCd' => 'A', 'UserIp' => '207.58.123.121', 'gsDebug' => '1' ), 'Req' => array( 'CountryID' => 'USA', 'RegionID' => '' ) ))\[/code\]...which returns the following the XML:\[code\]<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><AreasResponse xmlns="http://xml.####.com/"><AreasResult><RetCd>0</RetCd><RetMsg /><Countries> <Country> <id>USA</id> <nm>United States</nm> <Regions> <Region> <id>AZ</id> <nm>Arizona</nm> <Areas> <Area> <id>Phoenix Northeast</id> <nm>Phoenix Northeast</nm> </Area> </Areas> </Region> <Region> <id>FL</id> <nm>Florida</nm> <Areas> <Area> <id>Ft. Myers/Naples</id> <nm>Ft. Myers/Naples</nm> </Area> <Area> <id>Miami / Ft. Lauderdale</id> <nm>Miami / Ft. Lauderdale</nm> </Area> </Areas> </Region> </Regions> </Country></Countries></AreasResult></AreasResponse></soap:Body></soap:Envelope>\[/code\]Now, here's how I'm handling this in my PHP:\[code\]foreach ($regionList->AreasResult->Countries->Country->Regions->Region as $region): echo $region->nm . ": "; foreach ($region->Area as $area): echo $area->nm . ", "; endforeach; echo "<br />";endforeach;\[/code\]Ideally, this would output as:\[quote\] Arizona: Phoenix Northeast,
Florida: Ft. Myers/Naples, Miami / Ft. Lauderdale,\[/quote\]But no! It's showing up like this:\[quote\] Arizona: , ,
Florida: Ft. Myers/Naples, Miami / Ft. Lauderdale,\[/quote\]The two commas after 'Arizona:' imply there are two records, but there's only one. Even more infuriating is that it won't output the dang Area value. What am I doing wrong? Help me, StackOverflow, you're my only hope!
Florida: Ft. Myers/Naples, Miami / Ft. Lauderdale,\[/quote\]But no! It's showing up like this:\[quote\] Arizona: , ,
Florida: Ft. Myers/Naples, Miami / Ft. Lauderdale,\[/quote\]The two commas after 'Arizona:' imply there are two records, but there's only one. Even more infuriating is that it won't output the dang Area value. What am I doing wrong? Help me, StackOverflow, you're my only hope!