|
Posted by Justin Koivisto on 10/10/05 20:42
ralphNOSPAM@primemail.com wrote:
> I'm trying to use strpos to find these xml tags so I can pull out the
> text data; but the bracket chars won't let the function work. Is there
> another way to do this?
>
> $php_XML_tag = "<codeFacility>ZNY</codeFacility>";
> $pos = strpos($php_XML_tag, '<codeFacility>');
> print $pos;
>
> results is $pos == 0
>
That's the correct result... if the function was failing, you'd get a
boolean FALSE instead...
$pos = strpos($php_XML_tag, '<codeFacility>');
if($pos===FALSE){
// the function call failed (not found)
}else{
echo "Pattern starts at character offset $pos of the string."
}
--
Justin Koivisto, ZCE - justin@koivi.com
http://koivi.com
Navigation:
[Reply to this message]
|