How to check whether a character exists in a string?

I display a textbox with the default value like ‘25%’.

On submitting the form I want to check whether the posted value have % sign or not.

//type-checking comparison operator is necessary
if (strpos($string, '%') !== false) { 
  //PERCENT SIGN FOUND
}

Thx it worked,
Now plz tell me how can I remove this cracter. 'cause I just want numbers.

Hmm… try this.

//replace all characters that are not numbers with nothing
$string = preg_replace("/[^0-9]/", "", $string);

Now I just want to remove this ‘%’ sign…

If the string is ‘25%’.
Then I would like the out put like ‘25’

$string = str_replace('%', '', $string);

Thx man!!

Its solved…