1--TEST-- 2XMLWriter::toMemory() - custom constructor 3--EXTENSIONS-- 4xmlwriter 5--FILE-- 6<?php 7 8class CustomXMLWriter extends XMLWriter { 9 public int $myField; 10 11 public function __construct() { 12 $this->myField = 1234; 13 echo "hello world\n"; 14 } 15} 16 17$writer = CustomXMLWriter::toMemory(); 18var_dump($writer); 19$writer->startElement("root"); 20$writer->endElement(); 21echo $writer->outputMemory(); 22 23?> 24--EXPECTF-- 25hello world 26object(CustomXMLWriter)#%d (1) { 27 ["myField"]=> 28 int(1234) 29} 30<root/> 31