3v4l.org

run code in 300+ PHP versions simultaneously
<?php function group($cond, $arr) { if (empty($arr)) return []; $e = array_shift($arr); $g = [$e]; while($cond($e, reset($arr))) { $g[] = array_shift($arr); } return array_merge([$g], group($cond, $arr)); } function it($m,$p){echo ($p?'OK':'NO')." It $m\n";} function eq($a,$b) {return $a==$b;} echo it ('groups', group('eq', [1,5,5,6,6,6,7,9]) == [[1],[5,5],[6,6,6],[7],[9]]);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/GtE2k
function name:  (null)
number of ops:  11
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   INIT_FCALL                                               'it'
          1        SEND_VAL                                                 'groups'
          2        INIT_FCALL                                               'group'
          3        SEND_VAL                                                 'eq'
          4        SEND_VAL                                                 <array>
          5        DO_FCALL                                      0  $0      
          6        IS_EQUAL                                         ~1      $0, <array>
          7        SEND_VAL                                                 ~1
          8        DO_FCALL                                      0  $2      
          9        ECHO                                                     $2
         10      > RETURN                                                   1

Function group:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 5
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
2 jumps found. (Code = 44) Position 1 = 25, Position 2 = 12
Branch analysis from position: 25
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
2 jumps found. (Code = 44) Position 1 = 25, Position 2 = 12
Branch analysis from position: 25
Branch analysis from position: 12
filename:       /in/GtE2k
function name:  group
number of ops:  36
compiled vars:  !0 = $cond, !1 = $arr, !2 = $e, !3 = $g
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    5     2        ISSET_ISEMPTY_CV                                         !1
          3      > JMPZ                                                     ~4, ->5
          4    > > RETURN                                                   <array>
    7     5    >   INIT_FCALL                                               'array_shift'
          6        SEND_REF                                                 !1
          7        DO_ICALL                                         $5      
          8        ASSIGN                                                   !2, $5
    8     9        INIT_ARRAY                                       ~7      !2
         10        ASSIGN                                                   !3, ~7
   10    11      > JMP                                                      ->17
   12    12    >   INIT_FCALL                                               'array_shift'
         13        SEND_REF                                                 !1
         14        DO_ICALL                                         $10     
         15        ASSIGN_DIM                                               !3
         16        OP_DATA                                                  $10
   10    17    >   INIT_DYNAMIC_CALL                                        !0
         18        SEND_VAR_EX                                              !2
         19        INIT_FCALL                                               'reset'
         20        SEND_REF                                                 !1
         21        DO_ICALL                                         $11     
         22        SEND_VAR_NO_REF_EX                                       $11
         23        DO_FCALL                                      0  $12     
         24      > JMPNZ                                                    $12, ->12
   15    25    >   INIT_FCALL                                               'array_merge'
         26        INIT_ARRAY                                       ~13     !3
         27        SEND_VAL                                                 ~13
         28        INIT_FCALL_BY_NAME                                       'group'
         29        SEND_VAR_EX                                              !0
         30        SEND_VAR_EX                                              !1
         31        DO_FCALL                                      0  $14     
         32        SEND_VAR                                                 $14
         33        DO_ICALL                                         $15     
         34      > RETURN                                                   $15
   16    35*     > RETURN                                                   null

End of function group

Function it:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 5
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/GtE2k
function name:  it
number of ops:  12
compiled vars:  !0 = $m, !1 = $p
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2      > JMPZ                                                     !1, ->5
          3    >   QM_ASSIGN                                        ~2      'OK'
          4      > JMP                                                      ->6
          5    >   QM_ASSIGN                                        ~2      'NO'
          6    >   ROPE_INIT                                     3  ~4      '+It+'
          7        ROPE_ADD                                      1  ~4      ~4, !0
          8        ROPE_END                                      2  ~3      ~4, '%0A'
          9        CONCAT                                           ~6      ~2, ~3
         10        ECHO                                                     ~6
         11      > RETURN                                                   null

End of function it

Function eq:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/GtE2k
function name:  eq
number of ops:  5
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        IS_EQUAL                                         ~2      !0, !1
          3      > RETURN                                                   ~2
          4*     > RETURN                                                   null

End of function eq

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.09 ms | 1394 KiB | 21 Q