You are here: Re: Function to seek a substring in a string « All PHP « IT news, forums, messages
Re: Function to seek a substring in a string

Posted by Janwillem Borleffs on 10/25/05 15:26

Jorge A wrote:
> Is there any function in PHP to know if a string is a substring of
> another string?
>
> For instance:
> $title="White men can't jump";
> $text="white";
>
> function($title, $text) would return a boolean depending on $text is a
> substring or not.
>
> I have only found some string compare functions flicking through the
> documentation.
>
> Thanks in advance!

On PHP5:

$match = stripos($title, $text) !== false;

On PHP4:

$match = strpos(strtolower($title), strtolower($text)) !== false;


JW

 

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

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