3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = [ 0 => [ "user_type" => 'Manager', "total_count" => 3, ], 1 => [ "user_type" => 'Director', "total_count" => 2, ], ]; /** * @param array $a */ function pr($a = []) { echo "<pre>"; print_r($a); echo "</pre>"; } $arr = array_combine(['labels','dataset'],array_map(null, ...$arr)); if(!in_array('Trainee',$arr['labels'])){ array_push($arr['labels'],'Trainee'); array_push($arr['dataset'],0); } print_r($arr);die;
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 18, Position 2 = 28
Branch analysis from position: 18
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 28
filename:       /in/n63Qb
function name:  (null)
number of ops:  33
compiled vars:  !0 = $arr
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   28     1        INIT_FCALL                                               'array_combine'
          2        SEND_VAL                                                 <array>
          3        INIT_FCALL                                               'array_map'
          4        SEND_VAL                                                 null
          5        SEND_UNPACK                                              !0
          6        CHECK_UNDEF_ARGS                                         
          7        DO_ICALL                                         $2      
          8        SEND_VAR                                                 $2
          9        DO_ICALL                                         $3      
         10        ASSIGN                                                   !0, $3
   29    11        INIT_FCALL                                               'in_array'
         12        SEND_VAL                                                 'Trainee'
         13        FETCH_DIM_R                                      ~5      !0, 'labels'
         14        SEND_VAL                                                 ~5
         15        DO_ICALL                                         $6      
         16        BOOL_NOT                                         ~7      $6
         17      > JMPZ                                                     ~7, ->28
   30    18    >   INIT_FCALL                                               'array_push'
         19        FETCH_DIM_W                                      $8      !0, 'labels'
         20        SEND_REF                                                 $8
         21        SEND_VAL                                                 'Trainee'
         22        DO_ICALL                                                 
   31    23        INIT_FCALL                                               'array_push'
         24        FETCH_DIM_W                                      $10     !0, 'dataset'
         25        SEND_REF                                                 $10
         26        SEND_VAL                                                 0
         27        DO_ICALL                                                 
   33    28    >   INIT_FCALL                                               'print_r'
         29        SEND_VAR                                                 !0
         30        DO_ICALL                                                 
         31      > EXIT                                                     
   34    32*     > RETURN                                                   1

Function pr:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/n63Qb
function name:  pr
number of ops:  7
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   RECV_INIT                                        !0      <array>
   24     1        ECHO                                                     '%3Cpre%3E'
   25     2        INIT_FCALL                                               'print_r'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                                 
   26     5        ECHO                                                     '%3C%2Fpre%3E'
   27     6      > RETURN                                                   null

End of function pr

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.17 ms | 1020 KiB | 18 Q