Jump to content


Photo

Checking a string for a value


  • Please log in to reply
1 reply to this topic

#1 markspec87

markspec87
  • Members
  • PipPipPip
  • Advanced Member
  • 63 posts

Posted 21 July 2006 - 03:19 PM

This is a follow on from my previous post but i thought its essentially a different question.

I got my variable $domain. How do i check that to see if it contains .co.uk or .net for example?

I.e "IF $domain contains .co.uk then price = 5.99 else price = 7.99"

:)

#2 spyke01

spyke01
  • Members
  • PipPipPip
  • Advanced Member
  • 74 posts

Posted 21 July 2006 - 03:22 PM

from http://us3.php.net/m...ion.stristr.php
<?php
  $string = 'Hello World!';
  if(stristr($string, 'earth') === FALSE) {
   echo '"earth" not found in string';
  }
// outputs: "earth" not found in string
?> 


[a href="http://www.fasttracksites.com" target="_blank"]Cheap PHP Hosting[/a]




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users