3v4l.org

run code in 300+ PHP versions simultaneously
<?php function addArrayIfNotEmpty($entire_array, $key, $childArray){ count($childArray) ? $entire_array[$key] = $childArray : null; return $entire_array; } $entire_array = array(); $entire_array = addArrayIfNotEmpty($entire_array, 'key1', array()); print_r($entire_array); $entire_array = addArrayIfNotEmpty($entire_array, 'key2', array('hello')); print_r($entire_array);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/0cHlA
function name:  (null)
number of ops:  20
compiled vars:  !0 = $entire_array
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   ASSIGN                                                   !0, <array>
    9     1        INIT_FCALL                                               'addarrayifnotempty'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 'key1'
          4        SEND_VAL                                                 <array>
          5        DO_FCALL                                      0  $2      
          6        ASSIGN                                                   !0, $2
   10     7        INIT_FCALL                                               'print_r'
          8        SEND_VAR                                                 !0
          9        DO_ICALL                                                 
   11    10        INIT_FCALL                                               'addarrayifnotempty'
         11        SEND_VAR                                                 !0
         12        SEND_VAL                                                 'key2'
         13        SEND_VAL                                                 <array>
         14        DO_FCALL                                      0  $5      
         15        ASSIGN                                                   !0, $5
   12    16        INIT_FCALL                                               'print_r'
         17        SEND_VAR                                                 !0
         18        DO_ICALL                                                 
         19      > RETURN                                                   1

Function addarrayifnotempty:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 9
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/0cHlA
function name:  addArrayIfNotEmpty
number of ops:  13
compiled vars:  !0 = $entire_array, !1 = $key, !2 = $childArray
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
    4     3        COUNT                                            ~3      !2
          4      > JMPZ                                                     ~3, ->9
          5    >   ASSIGN_DIM                                       ~4      !0, !1
          6        OP_DATA                                                  !2
          7        QM_ASSIGN                                        ~5      ~4
          8      > JMP                                                      ->10
          9    >   QM_ASSIGN                                        ~5      null
         10    >   FREE                                                     ~5
    5    11      > RETURN                                                   !0
    6    12*     > RETURN                                                   null

End of function addarrayifnotempty

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
185.99 ms | 1448 KiB | 16 Q