can any tell how to remove characters after ? in php. I have one string test?=new i need to remove the characters as well as = from that string.
Here is one-liner:
$s = strpos($s, '?') !== FALSE ? strtok($s, '?') : $s;
You can test it by the following command-line:
php -r '$s = "123?456"; $s = strpos($s, "?") !== FALSE ? strtok($s, "?") : $s; echo $s;'