3v4l.org

run code in 500+ PHP versions simultaneously
<?php class xml { var $parser; function __construct() { $this->parser = xml_parser_create(); xml_set_object($this->parser, $this); } function parse($data) { xml_parse($this->parser, $data); } function free(){ xml_parser_free($this->parser); //unset($this->parser); } } $xml_test = '<?xml version="1.0" encoding="utf-8"?><test></test>'; for ($i = 0; $i < 100; $i++) { $xml_parser = new xml(); $xml_parser->parse($xml_test); $xml_parser->free(); unset($xml_parser); gc_collect_cycles(); echo memory_get_usage(), PHP_EOL; }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 19
Branch analysis from position: 19
2 jumps found. (Code = 44) Position 1 = 21, Position 2 = 3
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 3
2 jumps found. (Code = 44) Position 1 = 21, Position 2 = 3
Branch analysis from position: 21
Branch analysis from position: 3
filename:       /in/JYIQs
function name:  (null)
number of ops:  22
compiled vars:  !0 = $xml_test, !1 = $i, !2 = $xml_parser
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   23     0  E >   ASSIGN                                                       !0, '%3C%3Fxml+version%3D%221.0%22+encoding%3D%22utf-8%22%3F%3E%3Ctest%3E%3C%2Ftest%3E'
   24     1        ASSIGN                                                       !1, 0
          2      > JMP                                                          ->19
   25     3    >   NEW                                                  $5      'xml'
          4        DO_FCALL                                          0          
          5        ASSIGN                                                       !2, $5
   26     6        INIT_METHOD_CALL                                             !2, 'parse'
          7        SEND_VAR_EX                                                  !0
          8        DO_FCALL                                          0          
   27     9        INIT_METHOD_CALL                                             !2, 'free'
         10        DO_FCALL                                          0          
   28    11        UNSET_CV                                                     !2
   29    12        INIT_FCALL                                                   'gc_collect_cycles'
         13        DO_ICALL                                                     
   30    14        INIT_FCALL                                                   'memory_get_usage'
         15        DO_ICALL                                             $11     
         16        ECHO                                                         $11
         17        ECHO                                                         '%0A'
   24    18        PRE_INC                                                      !1
         19    >   IS_SMALLER                                                   !1, 100
         20      > JMPNZ                                                        ~13, ->3
   31    21    > > RETURN                                                       1

Class xml:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/JYIQs
function name:  __construct
number of ops:  11
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    8     0  E >   INIT_FCALL                                                   'xml_parser_create'
          1        DO_ICALL                                             $1      
          2        ASSIGN_OBJ                                                   'parser'
          3        OP_DATA                                                      $1
    9     4        INIT_FCALL                                                   'xml_set_object'
          5        FETCH_OBJ_R                                          ~2      'parser'
          6        SEND_VAL                                                     ~2
          7        FETCH_THIS                                           ~3      
          8        SEND_VAL                                                     ~3
          9        DO_FCALL_BY_NAME                                             
   10    10      > RETURN                                                       null

End of function __construct

Function parse:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/JYIQs
function name:  parse
number of ops:  7
compiled vars:  !0 = $data
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   12     0  E >   RECV                                                 !0      
   14     1        INIT_FCALL                                                   'xml_parse'
          2        FETCH_OBJ_R                                          ~1      'parser'
          3        SEND_VAL                                                     ~1
          4        SEND_VAR                                                     !0
          5        DO_ICALL                                                     
   15     6      > RETURN                                                       null

End of function parse

Function free:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/JYIQs
function name:  free
number of ops:  5
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   18     0  E >   INIT_FCALL                                                   'xml_parser_free'
          1        FETCH_OBJ_R                                          ~0      'parser'
          2        SEND_VAL                                                     ~0
          3        DO_FCALL_BY_NAME                                             
   20     4      > RETURN                                                       null

End of function free

End of class xml.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
164.65 ms | 1293 KiB | 19 Q