3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = "00 a 51 - a9b"; $numbers = ""; $chars = ""; preg_match_all("/(\d*)(\D*)/", $string, $matches); //print_r($matches); foreach($matches[1] as $match) { $numbers .= is_numeric($match) ? $match : ''; } foreach($matches[2] as $match) { $chars .= !is_numeric($match) ? $match : ''; } var_dump($numbers); echo " "; var_dump($chars);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 10, Position 2 = 20
Branch analysis from position: 10
2 jumps found. (Code = 78) Position 1 = 11, Position 2 = 20
Branch analysis from position: 11
2 jumps found. (Code = 43) Position 1 = 15, Position 2 = 17
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 18
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
Branch analysis from position: 20
2 jumps found. (Code = 77) Position 1 = 23, Position 2 = 34
Branch analysis from position: 23
2 jumps found. (Code = 78) Position 1 = 24, Position 2 = 34
Branch analysis from position: 24
2 jumps found. (Code = 43) Position 1 = 29, Position 2 = 31
Branch analysis from position: 29
1 jumps found. (Code = 42) Position 1 = 32
Branch analysis from position: 32
1 jumps found. (Code = 42) Position 1 = 23
Branch analysis from position: 23
Branch analysis from position: 31
1 jumps found. (Code = 42) Position 1 = 23
Branch analysis from position: 23
Branch analysis from position: 34
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 34
Branch analysis from position: 20
filename:       /in/ni1KE
function name:  (null)
number of ops:  43
compiled vars:  !0 = $string, !1 = $numbers, !2 = $chars, !3 = $matches, !4 = $match
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, '00+a+51+-+a9b'
    3     1        ASSIGN                                                   !1, ''
    4     2        ASSIGN                                                   !2, ''
    6     3        INIT_FCALL                                               'preg_match_all'
          4        SEND_VAL                                                 '%2F%28%5Cd%2A%29%28%5CD%2A%29%2F'
          5        SEND_VAR                                                 !0
          6        SEND_REF                                                 !3
          7        DO_ICALL                                                 
    9     8        FETCH_DIM_R                                      ~9      !3, 1
          9      > FE_RESET_R                                       $10     ~9, ->20
         10    > > FE_FETCH_R                                               $10, !4, ->20
   10    11    >   INIT_FCALL                                               'is_numeric'
         12        SEND_VAR                                                 !4
         13        DO_ICALL                                         $11     
         14      > JMPZ                                                     $11, ->17
         15    >   QM_ASSIGN                                        ~12     !4
         16      > JMP                                                      ->18
         17    >   QM_ASSIGN                                        ~12     ''
         18    >   ASSIGN_OP                                     8          !1, ~12
    9    19      > JMP                                                      ->10
         20    >   FE_FREE                                                  $10
   13    21        FETCH_DIM_R                                      ~14     !3, 2
         22      > FE_RESET_R                                       $15     ~14, ->34
         23    > > FE_FETCH_R                                               $15, !4, ->34
   14    24    >   INIT_FCALL                                               'is_numeric'
         25        SEND_VAR                                                 !4
         26        DO_ICALL                                         $16     
         27        BOOL_NOT                                         ~17     $16
         28      > JMPZ                                                     ~17, ->31
         29    >   QM_ASSIGN                                        ~18     !4
         30      > JMP                                                      ->32
         31    >   QM_ASSIGN                                        ~18     ''
         32    >   ASSIGN_OP                                     8          !2, ~18
   13    33      > JMP                                                      ->23
         34    >   FE_FREE                                                  $15
   17    35        INIT_FCALL                                               'var_dump'
         36        SEND_VAR                                                 !1
         37        DO_ICALL                                                 
   18    38        ECHO                                                     '+'
   19    39        INIT_FCALL                                               'var_dump'
         40        SEND_VAR                                                 !2
         41        DO_ICALL                                                 
         42      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
147.91 ms | 1405 KiB | 19 Q