How can I cut the string before ‘(‘ sign with php
For example: $a = ‘abc dec g (gold)’;
How can I cut the string become only ‘abc dec g’??
I tried to used this strstr($a, ‘(‘, true) but error display.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You could do this, using
explode:Or you could also do this, using
substrandstrpos:The reason you got the error using
strstris because the last argument is not available unless you have PHP 5.3.0 or later.