" sign in the string PHP?" />
S
S
Sp1keazyYT2019-06-24 13:24:07
PHP
Sp1keazyYT, 2019-06-24 13:24:07

How to print a number from a string if there is a ">" sign in the string PHP?

Good afternoon. There is the following code:

$str_test = ">100";
if (preg_match('/(>)?(\d+)/i', $str_test, $matches)) {
  print_r($matches[0]);
}

As a result, >100 is displayed, but I need to display only a number if there is a ">" sign in the string. How to do it?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question