3v4l.org

run code in 500+ PHP versions simultaneously
<?php $re = '/(?i)^((?:[a-z]+(?:\h+[a-z]+)*)?)\h*(\d+(?:\h+\d+)*)\h*((?:[a-z]+(?:\h+[a-z]+)*)?)?$/mi'; $str = 'from 8 000 packs test from 8 000 packs test 432534534 from 344454 packs 45054 packs 04 555 434654 54 564 packs'; preg_match_all($re, $str, $matches, PREG_SET_ORDER, 0); foreach($matches as $match) { list(,$before, $num, $after) = $match; echo sprintf( "before: %s\nnum:%s\nafter:%s\n--------------------\n", $before, preg_replace("/\h+/", "", $num), $after ); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 10, Position 2 = 30
Branch analysis from position: 10
2 jumps found. (Code = 78) Position 1 = 11, Position 2 = 30
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
Branch analysis from position: 30
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 30
filename:       /in/43flW
function name:  (null)
number of ops:  32
compiled vars:  !0 = $re, !1 = $str, !2 = $matches, !3 = $match, !4 = $before, !5 = $num, !6 = $after
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, '%2F%28%3Fi%29%5E%28%28%3F%3A%5Ba-z%5D%2B%28%3F%3A%5Ch%2B%5Ba-z%5D%2B%29%2A%29%3F%29%5Ch%2A%28%5Cd%2B%28%3F%3A%5Ch%2B%5Cd%2B%29%2A%29%5Ch%2A%28%28%3F%3A%5Ba-z%5D%2B%28%3F%3A%5Ch%2B%5Ba-z%5D%2B%29%2A%29%3F%29%3F%24%2Fmi'
    4     1        ASSIGN                                                       !1, 'from+8+000+packs%0Atest+from+8+000+packs+test%0A432534534%0Afrom+344454+packs%0A45054+packs%0A04+555%0A434654%0A54+564+packs'
   13     2        INIT_FCALL                                                   'preg_match_all'
          3        SEND_VAR                                                     !0
          4        SEND_VAR                                                     !1
          5        SEND_REF                                                     !2
          6        SEND_VAL                                                     2
          7        SEND_VAL                                                     0
          8        DO_ICALL                                                     
   15     9      > FE_RESET_R                                           $10     !2, ->30
         10    > > FE_FETCH_R                                                   $10, !3, ->30
   16    11    >   QM_ASSIGN                                            ~11     !3
         12        FETCH_LIST_R                                         $12     ~11, 1
         13        ASSIGN                                                       !4, $12
         14        FETCH_LIST_R                                         $14     ~11, 2
         15        ASSIGN                                                       !5, $14
         16        FETCH_LIST_R                                         $16     ~11, 3
         17        ASSIGN                                                       !6, $16
         18        FREE                                                         ~11
   19    19        FRAMELESS_ICALL_3                preg_replace        ~18     '%2F%5Ch%2B%2F', ''
         20        OP_DATA                                                      !5
         21        ROPE_INIT                                         7  ~20     'before%3A+'
         22        ROPE_ADD                                          1  ~20     ~20, !4
         23        ROPE_ADD                                          2  ~20     ~20, '%0Anum%3A'
         24        ROPE_ADD                                          3  ~20     ~20, ~18
         25        ROPE_ADD                                          4  ~20     ~20, '%0Aafter%3A'
         26        ROPE_ADD                                          5  ~20     ~20, !6
         27        ROPE_END                                          6  ~19     ~20, '%0A--------------------%0A'
         28        ECHO                                                         ~19
   15    29      > JMP                                                          ->10
         30    >   FE_FREE                                                      $10
   21    31      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
162.49 ms | 1966 KiB | 14 Q