3v4l.org

run code in 300+ PHP versions simultaneously
<?php function myfunction($array){ echo PHP_EOL . 'pass $array to function...' . PHP_EOL; var_dump(memory_get_usage()); echo PHP_EOL . 'modify $array...' . PHP_EOL; $array[343] = 23; var_dump(memory_get_usage()); } function myfunction_passbyref(&$array){ echo PHP_EOL . 'pass-by-ref $array to function...' . PHP_EOL; var_dump(memory_get_usage()); echo PHP_EOL . 'modify $array...' . PHP_EOL; $array[343] = 23; var_dump(memory_get_usage()); } echo PHP_EOL . 'init $array with 10k elements...' . PHP_EOL; $array = range(1,10000); var_dump(memory_get_usage()); myfunction_passbyref($array); myfunction($array);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/uhrDt
function name:  (null)
number of ops:  18
compiled vars:  !0 = $array
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   ECHO                                                     '%0Ainit+%24array+with+10k+elements...%0A'
   21     1        INIT_FCALL                                               'range'
          2        SEND_VAL                                                 1
          3        SEND_VAL                                                 10000
          4        DO_ICALL                                         $1      
          5        ASSIGN                                                   !0, $1
   22     6        INIT_FCALL                                               'var_dump'
          7        INIT_FCALL                                               'memory_get_usage'
          8        DO_ICALL                                         $3      
          9        SEND_VAR                                                 $3
         10        DO_ICALL                                                 
   23    11        INIT_FCALL                                               'myfunction_passbyref'
         12        SEND_REF                                                 !0
         13        DO_FCALL                                      0          
   24    14        INIT_FCALL                                               'myfunction'
         15        SEND_VAR                                                 !0
         16        DO_FCALL                                      0          
         17      > RETURN                                                   1

Function myfunction:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/uhrDt
function name:  myfunction
number of ops:  16
compiled vars:  !0 = $array
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
    3     1        ECHO                                                     '%0Apass+%24array+to+function...%0A'
    4     2        INIT_FCALL                                               'var_dump'
          3        INIT_FCALL                                               'memory_get_usage'
          4        DO_ICALL                                         $1      
          5        SEND_VAR                                                 $1
          6        DO_ICALL                                                 
    6     7        ECHO                                                     '%0Amodify+%24array...%0A'
    7     8        ASSIGN_DIM                                               !0, 343
          9        OP_DATA                                                  23
    8    10        INIT_FCALL                                               'var_dump'
         11        INIT_FCALL                                               'memory_get_usage'
         12        DO_ICALL                                         $4      
         13        SEND_VAR                                                 $4
         14        DO_ICALL                                                 
    9    15      > RETURN                                                   null

End of function myfunction

Function myfunction_passbyref:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/uhrDt
function name:  myfunction_passbyref
number of ops:  16
compiled vars:  !0 = $array
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   RECV                                             !0      
   12     1        ECHO                                                     '%0Apass-by-ref+%24array+to+function...%0A'
   13     2        INIT_FCALL                                               'var_dump'
          3        INIT_FCALL                                               'memory_get_usage'
          4        DO_ICALL                                         $1      
          5        SEND_VAR                                                 $1
          6        DO_ICALL                                                 
   15     7        ECHO                                                     '%0Amodify+%24array...%0A'
   16     8        ASSIGN_DIM                                               !0, 343
          9        OP_DATA                                                  23
   17    10        INIT_FCALL                                               'var_dump'
         11        INIT_FCALL                                               'memory_get_usage'
         12        DO_ICALL                                         $4      
         13        SEND_VAR                                                 $4
         14        DO_ICALL                                                 
   18    15      > RETURN                                                   null

End of function myfunction_passbyref

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
146.44 ms | 1402 KiB | 21 Q