Jump to content

May be an array or may not


blinks

Recommended Posts

I've the following line -

 

$rsd_pids=$parsed_xml['PIDs']['pid'];

 

which reads the content of the <pid> tag of an XML file.

 

Sometimes there may be one <pid> tag, and sometimes more. My code works fine - creates an array - if there is more than one PID tag. $rsd_pids becomes a string if there is just one <pid>. How do I force it to read a single value as an array, not a string?

 

TIA

Link to comment
https://forums.phpfreaks.com/topic/191014-may-be-an-array-or-may-not/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.