Re: check string contens

From: Date: Tue, 27 Jun 2000 19:58:18 +0000
Subject: Re: check string contens
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-670@lists.php.net to get a copy of this message
Reading the manual would probably help. strcmp returns < 0 if str1 is less than str2, > 0 if str1 is greater that str2 and 0 if they are equal. Your check should be: if ($binchk != 0) { And the strcmp should probably be between $test and $mask. Eelco de Graaff wrote: > > What am i dooing wrong. I want to check for the string http:// > in a > datafield and if it is there do nothing and if it is not there add it. > > $mask="http://"; > $test=strtolower(trim(substr($webpage,0,7))); > $binchk=strcmp($webpage,$mask); > if ($binchk<=1){ > $webpage=$mask.$webpage; > } > # ** end > > Thanks ... > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net > For additional commands, e-mail: php-db-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.db (#670) next »