Hello,
I need to be able to count the number of rows that an XML response contains, here is the code that receives the XML response:
$request = file_get_contents($request_url) or die("feed not loading");
{
$xml = new SimpleXMLElement( $request );
foreach ( $xml->data_list->data->agent_list->agent as $agent )
{
echo
( string ) $agent['index'], "\n",
( string ) ucwords(strtolower(utf8_decode($agent->name))), "\n",
( string ) ucwords(strtolower(utf8_decode($agent->address))), "\n",
( string ) ucwords(strtolower(utf8_decode($agent->address2))), "\n",
( string ) ucwords(strtolower(utf8_decode($agent->zipcode))), "\n",
( string ) ucwords(strtolower(utf8_decode($agent->city))), "\n",
( string ) $agent->agent_number, "\n",
"<p>";
}
}
Now, I want to be able to count the number of agents (the number of returned arrays or what it is called, the number of times it will loop). How can I do that?
/Oskar