3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = "50+16-0*387/2+49"; $digits = []; $symbols = []; preg_match_all("/(\d+)|(\D+)/", $str, $matches, PREG_SET_ORDER); foreach ($matches as $match) { if ($match[1] !== '') { $digits[] = $match[1]; } else { $symbols[] = $match[2]; } } var_export($digits); echo "\n---\n"; var_export($symbols);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 10, Position 2 = 22
Branch analysis from position: 10
2 jumps found. (Code = 78) Position 1 = 11, Position 2 = 22
Branch analysis from position: 11
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 18
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 21
Branch analysis from position: 21
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
Branch analysis from position: 22
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 22
filename:       /in/REd1U
function name:  (null)
number of ops:  31
compiled vars:  !0 = $str, !1 = $digits, !2 = $symbols, !3 = $matches, !4 = $match
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '50%2B16-0%2A387%2F2%2B49'
    5     1        ASSIGN                                                   !1, <array>
    6     2        ASSIGN                                                   !2, <array>
    8     3        INIT_FCALL                                               'preg_match_all'
          4        SEND_VAL                                                 '%2F%28%5Cd%2B%29%7C%28%5CD%2B%29%2F'
          5        SEND_VAR                                                 !0
          6        SEND_REF                                                 !3
          7        SEND_VAL                                                 2
          8        DO_ICALL                                                 
    9     9      > FE_RESET_R                                       $9      !3, ->22
         10    > > FE_FETCH_R                                               $9, !4, ->22
   10    11    >   FETCH_DIM_R                                      ~10     !4, 1
         12        IS_NOT_IDENTICAL                                         ~10, ''
         13      > JMPZ                                                     ~11, ->18
   11    14    >   FETCH_DIM_R                                      ~13     !4, 1
         15        ASSIGN_DIM                                               !1
         16        OP_DATA                                                  ~13
   10    17      > JMP                                                      ->21
   13    18    >   FETCH_DIM_R                                      ~15     !4, 2
         19        ASSIGN_DIM                                               !2
         20        OP_DATA                                                  ~15
    9    21    > > JMP                                                      ->10
         22    >   FE_FREE                                                  $9
   17    23        INIT_FCALL                                               'var_export'
         24        SEND_VAR                                                 !1
         25        DO_ICALL                                                 
   18    26        ECHO                                                     '%0A---%0A'
   19    27        INIT_FCALL                                               'var_export'
         28        SEND_VAR                                                 !2
         29        DO_ICALL                                                 
         30      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
145.03 ms | 1004 KiB | 15 Q