0
$inputString = '->11гe+20∆∆A+4µcњil->5•Ћ®†Ѓ p+5f-7Ќ¬f pro+10g+1悦ra->58->44m+1*m+2a喜er!';

preg_match("/->(\d+)/",$inputString,$output);

print($output[1]);

в $output[1] попадает число 11, в $output[2] пусто, почему? Как получить все числа после определенного символа?

1 ответ 1

1

Используйте функцию preg_match_all

https://www.php.net/manual/ru/function.preg-match-all.php

    $inputString = '->11гe+20∆∆A+4µcњil->5•Ћ®†Ѓ p+5f-7Ќ¬f pro+10g+1悦ra->58->44m+1*m+2a喜er!';

    preg_match_all("/->(\d+)/", $inputString, $output);

    print_r($output);

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge you have read our privacy policy.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.