i am using following code to return only digital values from the variable, wounder how to get only character value “testing” from the variable and want to remove “on” from the string.
<?php
$valuecheck="testing on 123568";
$check1=preg_replace('/\D/', '', $valuecheck);
echo $check1;
?>
Output required:
testing
Thanks
Instead of
\D, use[^a-zA-Z](assuming that’s what you mean by “character value”). Basically, put[^SOMETHING], where that “something” is a set of all the characters you want to consider valid.