ok i'm trying to know what function where you can see if it contains something. like ex. does anyone know of a function like this?

if (func_contains('a') 
{
//action
}
else

I am not sure what your asking.. do you mean to create a function to see if $a contains something?

I am not sure what your asking.. do you mean to create a function to see if $a contains something?

like i'm trying to see if it like $_POST contains the character apostrophe or the letter A. i know bout the strip slashing but i'm trying to see if it does contain that character.

You can just use an if statement..

if($_POST['blah'] == 'a') {
do something 
} else if($_POST['blah'] == ''') {
do something else
}

You can just use an if statement..

if($_POST['blah'] == 'a') {
do something 
} else if($_POST['blah'] == ''') {
do something else
}

i know i put that in the main... but what i mean the input may also contain something else. like ab. and i dont want to make a million if statements or cases.

$str = 'a';
$regex = "/" . $str . "/";
if (preg_match($regex,$_POST['blah'])) {
      do something if the str is found
}
else {
     do something if the str is not found
}

or use

$str = 'a';
if (strpos($_POST['blah'],$str) === false) {
    string not found
}
else {
    string found
}
This article has been dead for over six months. Start a new discussion instead.