3v4l.org

run code in 300+ PHP versions simultaneously
<?php $re = '~[-+]?[0-9]*\.?[0-9]+(?:[eE][-+]?[0-9]+)?|\d+|(?>\p{L}\p{M}*+)+~u'; $text = "The example number 2 is a bad example it will not \ncount numbers and punctuations !! X is 2.5674."; if (preg_match_all($re, $text, $matches)) { echo count($matches[0]) . PHP_EOL; print_r($matches[0]); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 16
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
filename:       /in/UYSGk
function name:  (null)
number of ops:  17
compiled vars:  !0 = $re, !1 = $text, !2 = $matches
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%7E%5B-%2B%5D%3F%5B0-9%5D%2A%5C.%3F%5B0-9%5D%2B%28%3F%3A%5BeE%5D%5B-%2B%5D%3F%5B0-9%5D%2B%29%3F%7C%5Cd%2B%7C%28%3F%3E%5Cp%7BL%7D%5Cp%7BM%7D%2A%2B%29%2B%7Eu'
    4     1        ASSIGN                                                   !1, 'The+example+number+2+is+a+bad+example+it+will+not+%0Acount+numbers++and+punctuations+%21%21+X+is+2.5674.'
    5     2        INIT_FCALL                                               'preg_match_all'
          3        SEND_VAR                                                 !0
          4        SEND_VAR                                                 !1
          5        SEND_REF                                                 !2
          6        DO_ICALL                                         $5      
          7      > JMPZ                                                     $5, ->16
    6     8    >   FETCH_DIM_R                                      ~6      !2, 0
          9        COUNT                                            ~7      ~6
         10        CONCAT                                           ~8      ~7, '%0A'
         11        ECHO                                                     ~8
    7    12        INIT_FCALL                                               'print_r'
         13        FETCH_DIM_R                                      ~9      !2, 0
         14        SEND_VAL                                                 ~9
         15        DO_ICALL                                                 
    8    16    > > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
142.61 ms | 1002 KiB | 15 Q