3v4l.org

run code in 300+ PHP versions simultaneously
<?php class LinkedList { private $_length = 0; private $_head; private $_tail; public function add($data) { $node = (object) array('data' => $data, 'next' => null); if ($this->_length == 0) { $this->_head = $node; $this->_tail = $node; } else { $this->_tail->next = $node; $this->_tail = $node; } $this->_length++; } } $a = new LinkedList(); $startMemory = memory_get_usage(); for ($i = 1; $i <= 78860; $i++) { $a->add($i); } $endMemory = memory_get_usage(); print((int) (($endMemory - $startMemory) / 1024) . '<br />');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
2 jumps found. (Code = 44) Position 1 = 14, Position 2 = 8
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
2 jumps found. (Code = 44) Position 1 = 14, Position 2 = 8
Branch analysis from position: 14
Branch analysis from position: 8
filename:       /in/oNnGO
function name:  (null)
number of ops:  23
compiled vars:  !0 = $a, !1 = $startMemory, !2 = $i, !3 = $endMemory
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   NEW                                              $4      'LinkedList'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $4
   22     3        INIT_FCALL                                               'memory_get_usage'
          4        DO_ICALL                                         $7      
          5        ASSIGN                                                   !1, $7
   23     6        ASSIGN                                                   !2, 1
          7      > JMP                                                      ->12
   24     8    >   INIT_METHOD_CALL                                         !0, 'add'
          9        SEND_VAR_EX                                              !2
         10        DO_FCALL                                      0          
   23    11        PRE_INC                                                  !2
         12    >   IS_SMALLER_OR_EQUAL                                      !2, 78860
         13      > JMPNZ                                                    ~12, ->8
   26    14    >   INIT_FCALL                                               'memory_get_usage'
         15        DO_ICALL                                         $13     
         16        ASSIGN                                                   !3, $13
   27    17        SUB                                              ~15     !3, !1
         18        DIV                                              ~16     ~15, 1024
         19        CAST                                          4  ~17     ~16
         20        CONCAT                                           ~18     ~17, '%3Cbr+%2F%3E'
         21        ECHO                                                     ~18
         22      > RETURN                                                   1

Class LinkedList:
Function add:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 13
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 18
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/oNnGO
function name:  add
number of ops:  20
compiled vars:  !0 = $data, !1 = $node
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
    8     1        INIT_ARRAY                                       ~2      !0, 'data'
          2        ADD_ARRAY_ELEMENT                                ~2      null, 'next'
          3        CAST                                          8  ~3      ~2
          4        ASSIGN                                                   !1, ~3
    9     5        FETCH_OBJ_R                                      ~5      '_length'
          6        IS_EQUAL                                                 ~5, 0
          7      > JMPZ                                                     ~6, ->13
   10     8    >   ASSIGN_OBJ                                               '_head'
          9        OP_DATA                                                  !1
   11    10        ASSIGN_OBJ                                               '_tail'
         11        OP_DATA                                                  !1
    9    12      > JMP                                                      ->18
   13    13    >   FETCH_OBJ_W                                      $9      '_tail'
         14        ASSIGN_OBJ                                               $9, 'next'
         15        OP_DATA                                                  !1
   14    16        ASSIGN_OBJ                                               '_tail'
         17        OP_DATA                                                  !1
   16    18    >   PRE_INC_OBJ                                              '_length'
   17    19      > RETURN                                                   null

End of function add

End of class LinkedList.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
138.94 ms | 984 KiB | 14 Q