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