3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?xml version="1.0" encoding="utf-8"?> <student> <data> <name> Utham Kumar </name> <course> MCA </course> <sem> 4 </sem> <email> iamutham@gmail.com </email> </data> <data> <name> Utham </name> <course> MCA </course> <sem> 2 </sem> <email> iamutham@gmail.com </email> </data> </student> $doc = new DOMDocument(); <?php $student = $doc->getElementsByTagName("data"); foreach($student as $data) { $names = $data->getElementsByTagName("name"); $name = $names->item(0)->nodeValue; $courses = $data->getElementsByTagName("course"); $course = $courses->item(0)->nodeValue; $semister = $data->getElementsByTagName("sem"); $sem = $semister->item(0)->nodeValue; $emails = $data->getElementsByTagName("email"); $email = $emails->item(0)->nodeValue; }
Output for 5.4.0 - 5.5.12
Parse error: syntax error, unexpected 'version' (T_STRING) in /in/TA5tZ on line 1
Process exited with code 255.
Output for 5.0.4 - 5.3.28
<?xml version="1.0" encoding="utf-8"?> <student> <data> <name> Utham Kumar </name> <course> MCA </course> <sem> 4 </sem> <email> iamutham@gmail.com </email> </data> <data> <name> Utham </name> <course> MCA </course> <sem> 2 </sem> <email> iamutham@gmail.com </email> </data> </student> $doc = new DOMDocument(); Notice: Undefined variable: doc in /in/TA5tZ on line 19 Fatal error: Call to a member function getElementsByTagName() on a non-object in /in/TA5tZ on line 19
Process exited with code 255.
Output for 5.0.0 - 5.0.3
<?xml version="1.0" encoding="utf-8"?> <student> <data> <name> Utham Kumar </name> <course> MCA </course> <sem> 4 </sem> <email> iamutham@gmail.com </email> </data> <data> <name> Utham </name> <course> MCA </course> <sem> 2 </sem> <email> iamutham@gmail.com </email> </data> </student> $doc = new DOMDocument(); Notice: Undefined variable: doc in /in/TA5tZ on line 19 Fatal error: Call to a member function getElementsByTagName() on a non-object in /in/TA5tZ on line 19
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_OBJECT_OPERATOR in /in/TA5tZ on line 23
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
Parse error: parse error, unexpected T_OBJECT_OPERATOR in /in/TA5tZ on line 23
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/TA5tZ on line 23
Process exited with code 255.