Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
You can use a regular expression (since such a tag is in question). Literally "anything, then a space-with-parenthesis, then everything up to the parenthesis, parenthesis." Throw out the zero element from the resulting array, which contains the entire string:
preg_match('/^(.+)\ \((.+)\)/', $name, $matches);
array_shift($matches);
$matches; /*Array
(
[0] => Ньютон И.И.
[1] => Тринити коледж, Кембридж
)*/
$name = "Ньютон И.И. (Тринити коледж, Кембридж)";
$name = substr($name, 0, -1);
$result = explode(' (', $name);
print_r($result);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question