3v4l.org

run code in 300+ PHP versions simultaneously
<?php function build_array() { for ($i=0;$i<10000;$i++){ $a[$i]=$i; } $i=null; return $a; } echo memory_get_usage(false), PHP_EOL; $a = build_array(); echo memory_get_usage(false), PHP_EOL; unset($a); echo memory_get_usage(false), PHP_EOL;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/L3Y8l
function name:  (null)
number of ops:  20
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   INIT_FCALL                                               'memory_get_usage'
          1        SEND_VAL                                                 <false>
          2        DO_ICALL                                         $1      
          3        ECHO                                                     $1
          4        ECHO                                                     '%0A'
   14     5        INIT_FCALL                                               'build_array'
          6        DO_FCALL                                      0  $2      
          7        ASSIGN                                                   !0, $2
   16     8        INIT_FCALL                                               'memory_get_usage'
          9        SEND_VAL                                                 <false>
         10        DO_ICALL                                         $4      
         11        ECHO                                                     $4
         12        ECHO                                                     '%0A'
   18    13        UNSET_CV                                                 !0
   20    14        INIT_FCALL                                               'memory_get_usage'
         15        SEND_VAL                                                 <false>
         16        DO_ICALL                                         $5      
         17        ECHO                                                     $5
         18        ECHO                                                     '%0A'
         19      > RETURN                                                   1

Function build_array:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 5
Branch analysis from position: 5
2 jumps found. (Code = 44) Position 1 = 7, Position 2 = 2
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 2
2 jumps found. (Code = 44) Position 1 = 7, Position 2 = 2
Branch analysis from position: 7
Branch analysis from position: 2
filename:       /in/L3Y8l
function name:  build_array
number of ops:  10
compiled vars:  !0 = $i, !1 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   ASSIGN                                                   !0, 0
          1      > JMP                                                      ->5
    6     2    >   ASSIGN_DIM                                               !1, !0
          3        OP_DATA                                                  !0
    5     4        PRE_INC                                                  !0
          5    >   IS_SMALLER                                               !0, 10000
          6      > JMPNZ                                                    ~5, ->2
    8     7    >   ASSIGN                                                   !0, null
    9     8      > RETURN                                                   !1
   10     9*     > RETURN                                                   null

End of function build_array

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
142.9 ms | 1013 KiB | 15 Q