strings and conditionals..

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:

if (strlen($myName) == 7) {

but got error...

I have looked at sections dealing with conditionals in tutorials, but don't see examles of this (also don't see functions like indexOf(), etc.. under Strings here,

thank you very much..


Relevant Pages

  • Re: attempting to return values from array from w/in a function
    ... What I get is an array w/ only the most recent array entry. ... I am new to PHP & do not have formal scripting ... you end up comparing strings, but the test you mean probably is simply: ... case 1: {codeblock} ...
  • Re: [PHP] pack it in
    ... that's where my brain goes to mush - all strings in php ... in php and such found in these 'binary files' that they need to be ... packallows you to format binary data. ... # Do the conversion the way that the system architecture wants to ...
  • Re: Storing condition in bitfield?
    ... which I would like to bind form field's validation scheme/condition. ... I believe that in PHP, you can actually store PHP code in strings, and ... opposed to, say, an XML or ASCII representation. ... Putting strings and XML will be of overhead, ...
  • Re: function-arguments by reference
    ... i want to avoid performance-problems by repeated ... function-calls with very long strings. ... (I am not familiar with php, ...
  • Re: preg_replace
    ... replacement in the two strings you have given. ... input element and every textarea element? ... contain php? ...