C
C
Constantine2020-04-15 02:25:55
PHP
Constantine, 2020-04-15 02:25:55

How to find all numbers in a string after a semicolon?

Help me out, I’m breaking the last convolution, I re-read a bunch but never entered.

Line example:
"iPhone 8; CPU iPhone OS 11_4_1 like Mac OS X; TELE2RU-SUBSCRIBER-POOL-NET; Tele2 Russia IP Network (NIN)"

Find all numbers after the first semicolon. How to find everything after the first ";" - found how to find all the numbers - found, I can’t combine (

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
sergant210, 2020-04-15
@sergant210

// $str - исходная строка
$second = explode(';', $str)[1];
$number = filter_var($second, FILTER_SANITIZE_NUMBER_INT);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question