I have an string, something like this:
$abcdef(+$1.00)
I’m trying to get the first part of the string before the first parenthesis:
$abcdef
Currently if I use strstr() it will return the part of the string after the specified character:
$newstr = strstr($var, '(');
I want the part before the occurrence. What is the reverse or opposite function of strstr() that will do that?
Pass true as the third parameter.
From the manual page you have linked:
Note: This parameter was only added in PHP 5.3. If for some reason you are left with an older version, a combination of
substr()andstrpos()should help: