Jump to content

Archived

This topic is now archived and is closed to further replies.

markspec87

Checking a string for a value

Recommended Posts

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"

:)

Share this post


Link to post
Share on other sites
from http://us3.php.net/manual/en/function.stristr.php
[code]
<?php
  $string = 'Hello World!';
  if(stristr($string, 'earth') === FALSE) {
  echo '"earth" not found in string';
  }
// outputs: "earth" not found in string
?>
[/code]

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.