You are here: Re: strings and conditionals.. « PHP Programming Language « IT news, forums, messages
Re: strings and conditionals..

Posted by Janwillem Borleffs on 06/11/06 21:18

maya wrote:
> hi, am new to PHP, trying to learn strings... I'm a bit mystifed
> about something.. how do you test for conditions in strings? for
> example, how would you do what in JavaScript (or Java) you do like
> this
> if (email.indexOf('@') != -1) { // etc..
>
> also how do you test for length of a string? I tried:
>

You are looking for the position of a specific characther, so use the search
facility on php.net by entering "position" and selecting "all php.net sites"
or "this mirror only" from the select next to the input box. The first
search result is the one you are looking for.

> if (strlen($myName) == 7) {
>
> but got error...
>

When the error is a notice, the probable cause would be that you didn't
initialize $myName.

If you want to learn PHP (or any other new language for that matter), the
best way is to start from scratch; point your browser to
http://www.php.net/manual/en/getting-started.php to start with the basics.


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

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