3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = "00 a 51 - a9b!_ æøå "; function splitNumsFromChars($haystack) { // yes this is litteraly what it does. the function name says it all. hahahahhaaha :)))) $numbers = ""; // init $chars = ""; // init preg_match_all("/(\d*)(\D*)/", $haystack, $matches); foreach($matches[1] as $match) { $numbers .= is_numeric($match) ? $match : ''; } foreach($matches[2] as $match) { $chars .= !is_numeric($match) ? $match : ''; } $return['numbers'] = $numbers; $return['chars'] = $chars; return $return; } var_dump(splitNumsFromChars($string));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Aq1m2
function name:  (null)
number of ops:  8
compiled vars:  !0 = $string
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, '00+a+51+-+a9b%21_+%C3%A6%C3%B8%C3%A5+%0A%0A'
   27     1        INIT_FCALL                                               'var_dump'
          2        INIT_FCALL                                               'splitnumsfromchars'
          3        SEND_VAR                                                 !0
          4        DO_FCALL                                      0  $2      
          5        SEND_VAR                                                 $2
          6        DO_ICALL                                                 
          7      > RETURN                                                   1

Function splitnumsfromchars:
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/Aq1m2
function name:  splitNumsFromChars
number of ops:  41
compiled vars:  !0 = $haystack, !1 = $numbers, !2 = $chars, !3 = $matches, !4 = $match, !5 = $return
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
    8     1        ASSIGN                                                   !1, ''
    9     2        ASSIGN                                                   !2, ''
   11     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                                                 
   13     8        FETCH_DIM_R                                      ~9      !3, 1
          9      > FE_RESET_R                                       $10     ~9, ->20
         10    > > FE_FETCH_R                                               $10, !4, ->20
   14    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
   13    19      > JMP                                                      ->10
         20    >   FE_FREE                                                  $10
   17    21        FETCH_DIM_R                                      ~14     !3, 2
         22      > FE_RESET_R                                       $15     ~14, ->34
         23    > > FE_FETCH_R                                               $15, !4, ->34
   18    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
   17    33      > JMP                                                      ->23
         34    >   FE_FREE                                                  $15
   21    35        ASSIGN_DIM                                               !5, 'numbers'
         36        OP_DATA                                                  !1
   22    37        ASSIGN_DIM                                               !5, 'chars'
         38        OP_DATA                                                  !2
   24    39      > RETURN                                                   !5
   25    40*     > RETURN                                                   null

End of function splitnumsfromchars

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.78 ms | 1403 KiB | 20 Q