3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $file = "index.php"; $line = 20; $type = "PHP_ERROR"; $friendly_errors["PHP_ERROR"] = "PHP Error"; $my_message = "Testo"; $format_backtrace = ""; $error_data = "<error>".PHP_EOL; $error_data .= "\t<dateline>".time()."</dateline>".PHP_EOL; $error_data .= "\t<script>".$file."</script>".PHP_EOL; $error_data .= "\t<line>".$line."</line>".PHP_EOL; $error_data .= "\t<type>".$type."</type>".PHP_EOL; $error_data .= "\t<friendly_type>".$friendly_errors[$type]."</friendly_type>".PHP_EOL; $error_data .= "\t<message>".$my_message."</message>".PHP_EOL; $error_data .= "\t<backtrace>".$format_backtrace."</backtrace>".PHP_EOL; $error_data .= "</error>".PHP_EOL; $i = 0; $doc = new DOMDocument(); $doc->loadXML($error_data); $errors = $doc->getElementsByTagName("error"); $dateline = $errors->item($i)->getElementsByTagName("dateline"); $file = $errors->item($i)->getElementsByTagName("script"); $line = $errors->item($i)->getElementsByTagName("line"); $type = $errors->item($i)->getElementsByTagName("type"); var_dump($dateline->item($i)->nodeValue, $file->item($i)->nodeValue, $line->item($i)->nodeValue, $type->item($i)->nodeValue);
based on l4OJ7
Output for 5.6.28, 7.0.20 - 7.2.0
string(10) "1443111745" string(9) "index.php" string(2) "20" string(9) "PHP_ERROR"
Output for 5.4.0 - 5.6.23, 7.0.0 - 7.0.8
string(10) "1443111744" string(9) "index.php" string(2) "20" string(9) "PHP_ERROR"