3v4l.org

run code in 300+ PHP versions simultaneously
<?php function create_docs($amount) { $documents = []; for ($i = 0; $i < $amount; $i++) { $documents[] = ['a' => $i]; } } echo memory_get_usage(true), PHP_EOL; create_docs(5000); echo memory_get_usage(true), PHP_EOL; create_docs(50000); echo memory_get_usage(true), PHP_EOL; create_docs(5000); echo memory_get_usage(true), PHP_EOL;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/2OVeU
function name:  (null)
number of ops:  30
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   INIT_FCALL                                               'memory_get_usage'
          1        SEND_VAL                                                 <true>
          2        DO_ICALL                                         $0      
          3        ECHO                                                     $0
          4        ECHO                                                     '%0A'
   14     5        INIT_FCALL                                               'create_docs'
          6        SEND_VAL                                                 5000
          7        DO_FCALL                                      0          
   15     8        INIT_FCALL                                               'memory_get_usage'
          9        SEND_VAL                                                 <true>
         10        DO_ICALL                                         $2      
         11        ECHO                                                     $2
         12        ECHO                                                     '%0A'
   17    13        INIT_FCALL                                               'create_docs'
         14        SEND_VAL                                                 50000
         15        DO_FCALL                                      0          
   18    16        INIT_FCALL                                               'memory_get_usage'
         17        SEND_VAL                                                 <true>
         18        DO_ICALL                                         $4      
         19        ECHO                                                     $4
         20        ECHO                                                     '%0A'
   20    21        INIT_FCALL                                               'create_docs'
         22        SEND_VAL                                                 5000
         23        DO_FCALL                                      0          
   21    24        INIT_FCALL                                               'memory_get_usage'
         25        SEND_VAL                                                 <true>
         26        DO_ICALL                                         $6      
         27        ECHO                                                     $6
         28        ECHO                                                     '%0A'
         29      > RETURN                                                   1

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

End of function create_docs

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
145.8 ms | 950 KiB | 19 Q