Hi Warwick

I'd suggest looking at the PHP manual, it is available at
http://www.php.net.

You can look for string functions in the manual.

If you were looking for a case insensitive comparision you could use
stristr, if you are looking for a case senstivie comparision you could use
strstr.

<?php // code to see if john is in the variable
    $jeff =  'my name is john';

    if (stristr($jeff, 'john')) {
        print 'john is in the variable';
    } else {
        print 'john is not in the variable';
    }
?>

If you are trying to see if the variable is John then you could do this

<?
    if ($jeff == 'John')) {
        print 'the variable is set to John';
    } else {
        print 'the variable is not set to John';
    }
?>

There are other ways to do this, this is just an example I created.

Jason
----- Original Message -----
From: "Warwick Berg" <[EMAIL PROTECTED]>
Newsgroups: php.general
To: <[EMAIL PROTECTED]>
Sent: Friday, March 22, 2002 5:55 AM
Subject: comparisons


> Hi
>
> Just learning php from the bottom. Can someone help with syntax please?
>
> Want to know about using ifs :
>
> If the string value "john" is present in the variable "jeff" then do, etc,
> etc. How do we see if a value is present in a string?
>
> Thanks
> Warwick
>
>
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to