You are here: Re: String 'starts with' function « PHP Programming Language « IT news, forums, messages
Re: String 'starts with' function

Posted by Erwin Moller on 03/09/06 11:11

Paul Morrison wrote:

> Hi
>
> I have looked at the PHP string functions and I cant see any function to
> check to see whether a string starts with a certain letter or letters. Is
> there any way of doing this with the built in functions?
>
> Cheers,
>
> Paul

Hi Paul,

You can do this in many way, but the easiest way is just get the first
character of the string using substr(), and compare it to what you want.

It is here:
http://nl2.php.net/manual/en/function.substr.php

if (substr('abcd',0,1) == 'a') ...

(Of course, if you like regexpr you can use them too. search for regexpr at
www.php.net for regexpr-functions)


Regards,
Erwin Moller

 

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

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