3v4l.org

run code in 300+ PHP versions simultaneously
<?php function toArray($string) { $chars = str_split($string); $array = array_reduce($chars, function($result, $current) { $previous = $result[] = array_pop($result); if (is_numeric($previous) && is_numeric($current)) { $result[] = array_pop($result) . $current; } else { $result[] = $current; } return $result; }, []); return array_slice($array, 1); } $input = '6+4*4+100+444*6*13*14'; print_r(toArray($input));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/qZsvs
function name:  (null)
number of ops:  8
compiled vars:  !0 = $input
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   ASSIGN                                                   !0, '6%2B4%2A4%2B100%2B444%2A6%2A13%2A14'
   22     1        INIT_FCALL                                               'print_r'
          2        INIT_FCALL                                               'toarray'
          3        SEND_VAR                                                 !0
          4        DO_FCALL                                      0  $2      
          5        SEND_VAR                                                 $2
          6        DO_ICALL                                                 
          7      > RETURN                                                   1

Function toarray:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/qZsvs
function name:  toArray
number of ops:  18
compiled vars:  !0 = $string, !1 = $chars, !2 = $array
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        INIT_FCALL                                               'str_split'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $3      
          4        ASSIGN                                                   !1, $3
    6     5        INIT_FCALL                                               'array_reduce'
          6        SEND_VAR                                                 !1
          7        DECLARE_LAMBDA_FUNCTION                          ~5      [0]
   16     8        SEND_VAL                                                 ~5
          9        SEND_VAL                                                 <array>
    6    10        DO_ICALL                                         $6      
         11        ASSIGN                                                   !2, $6
   18    12        INIT_FCALL                                               'array_slice'
         13        SEND_VAR                                                 !2
         14        SEND_VAL                                                 1
         15        DO_ICALL                                         $8      
         16      > RETURN                                                   $8
   19    17*     > RETURN                                                   null


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 12, Position 2 = 16
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 24
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 26
Branch analysis from position: 26
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 24
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
filename:       /in/qZsvs
function name:  {closure}
number of ops:  28
compiled vars:  !0 = $result, !1 = $current, !2 = $previous
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    7     2        INIT_FCALL                                               'array_pop'
          3        SEND_REF                                                 !0
          4        DO_ICALL                                         $4      
          5        ASSIGN_DIM                                       ~3      !0
          6        OP_DATA                                                  $4
          7        ASSIGN                                                   !2, ~3
    9     8        INIT_FCALL                                               'is_numeric'
          9        SEND_VAR                                                 !2
         10        DO_ICALL                                         $6      
         11      > JMPZ_EX                                          ~7      $6, ->16
         12    >   INIT_FCALL                                               'is_numeric'
         13        SEND_VAR                                                 !1
         14        DO_ICALL                                         $8      
         15        BOOL                                             ~7      $8
         16    > > JMPZ                                                     ~7, ->24
   10    17    >   INIT_FCALL                                               'array_pop'
         18        SEND_REF                                                 !0
         19        DO_ICALL                                         $10     
         20        CONCAT                                           ~11     $10, !1
         21        ASSIGN_DIM                                               !0
         22        OP_DATA                                                  ~11
    9    23      > JMP                                                      ->26
   12    24    >   ASSIGN_DIM                                               !0
         25        OP_DATA                                                  !1
   15    26    > > RETURN                                                   !0
   16    27*     > RETURN                                                   null

End of Dynamic Function 0

End of function toarray

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
145.01 ms | 1023 KiB | 20 Q