Page 1 of 1

detecting \ in a string

Posted: Fri Jan 06, 2006 12:47 pm
by nincha
Any one have any ideas?

Posted: Fri Jan 06, 2006 1:01 pm
by Burrito
take a look at strpos() for your easiest solution....

Posted: Fri Jan 06, 2006 1:06 pm
by jayshields
You beat me to it, but more specifically, try this snippet:

Code: Select all

<?php
  if (strpos($yourstring, '\\') === FALSE) {
    echo 'Your string does not contain \\';
  } else {
    echo 'Your string does contain \\';
  }
?>