3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ '500 - 1112', ' 1113 - 2224', '2225 - 4446 ', '4446' ]; var_export( array_reduce( $array, function ($result, $v) { if (sscanf($v, '%d - %d', $ints[], $ints[]) === 2) { $result[0] ??= []; array_push($result[0], ...$ints); } else { $result[1] = $ints[0]; } return $result; }, [] ) );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6TCUj
function name:  (null)
number of ops:  11
compiled vars:  !0 = $array
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   10     1        INIT_FCALL                                               'var_export'
   11     2        INIT_FCALL                                               'array_reduce'
   12     3        SEND_VAR                                                 !0
   13     4        DECLARE_LAMBDA_FUNCTION                          ~2      [0]
   21     5        SEND_VAL                                                 ~2
   22     6        SEND_VAL                                                 <array>
   11     7        DO_ICALL                                         $3      
   22     8        SEND_VAR                                                 $3
   10     9        DO_ICALL                                                 
   24    10      > RETURN                                                   1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 25
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 28
Branch analysis from position: 28
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 25
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6TCUj
function name:  {closure}
number of ops:  30
compiled vars:  !0 = $result, !1 = $v, !2 = $ints
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   14     2        INIT_FCALL                                               'sscanf'
          3        SEND_VAR                                                 !1
          4        SEND_VAL                                                 '%25d+-+%25d'
          5        FETCH_DIM_W                                      $3      !2
          6        SEND_REF                                                 $3
          7        FETCH_DIM_W                                      $4      !2
          8        SEND_REF                                                 $4
          9        DO_ICALL                                         $5      
         10        IS_IDENTICAL                                             $5, 2
         11      > JMPZ                                                     ~6, ->25
   15    12    >   FETCH_DIM_IS                                     ~7      !0, 0
         13        COALESCE                                         ~8      ~7
         14        ASSIGN_DIM                                       ~9      !0, 0
         15        OP_DATA                                                  <array>
         16        QM_ASSIGN                                        ~8      ~9
         17        FREE                                                     ~8
   16    18        INIT_FCALL                                               'array_push'
         19        FETCH_DIM_W                                      $10     !0, 0
         20        SEND_REF                                                 $10
         21        SEND_UNPACK                                              !2
         22        CHECK_UNDEF_ARGS                                         
         23        DO_ICALL                                                 
   14    24      > JMP                                                      ->28
   18    25    >   FETCH_DIM_R                                      ~13     !2, 0
         26        ASSIGN_DIM                                               !0, 1
         27        OP_DATA                                                  ~13
   20    28    > > RETURN                                                   !0
   21    29*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
130.59 ms | 1018 KiB | 17 Q