RE: [PHP] Check contents of variable

From: Date: Tue, 20 Nov 2001 22:44:22 +0000
Subject: RE: [PHP] Check contents of variable
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-75310@lists.php.net to get a copy of this message
You could also try: if(! ereg('^http://', $url))
        $url = 'http://' . $url;
-JAson Garber At 11:15 PM 11/20/2001 +0100, Daniel Alsén wrote:
How about: if (substr($url,0,7) <> "http://")
    $url = "http://" . $url;
Thanks! That´s just the function i am looking for. I looked it up in the manual. Correct me if i am wrong - if i don´t set the second parameter in substr it just continues to read until the variable is finished? If i set it to 7 (as above) it stops reading after 7 characters? - Daniel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net


« previous php.general (#75310) next »