Arquivos
hhvm/hphp/test/slow/xml/1667.php
T
Paul Tarjan c2ec1c97c9 sortof format slow tests
A poor man's formatter since I didn't like any of the other ones I found. The original C++ source sometimes put newlines and sometimes not.

Codemods:

    codemod '([;{}])([^\n])' '\1\n\2'
    codemod -m '\s*<\?php\s+' '<?php\n\n'
    codemod '\t' '  '

I hand-fixed all the failing tests
2013-05-30 17:32:57 -07:00

27 linhas
604 B
PHP

<?php
class xml {
var $parser;
function xml() {
$this->parser = xml_parser_create();
xml_set_object($this->parser, $this);
xml_set_element_handler($this->parser, 'tag_open', 'tag_close');
xml_set_character_data_handler($this->parser, 'cdata');
}
function parse($data) {
xml_parse($this->parser, $data);
}
function tag_open($parser, $tag, $attributes) {
var_dump($tag, $attributes);
}
function cdata($parser, $cdata) {
var_dump($cdata);
}
function tag_close($parser, $tag){
var_dump($tag);
}
}
$xml_parser = new xml();
$xml_parser->parse('<A ID="hallo">PHP</A>');