3v4l.org

run code in 300+ 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; }

preferences:
40.32 ms | 409 KiB | 5 Q