You are here: Re: StrPos Help « PHP Programming Language « IT news, forums, messages
Re: StrPos Help

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация