3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> </head> <body> <form method="post"> <textarea name="data" style="width: 100%; height: 300px"></textarea> <input type="submit"> </form> <?php $data = isset($_POST['data']) ? $_POST['data'] : ""; if ($data) { function parse($text) { global $foundName; global $foundCoord; $foundName = array(); $foundCoord = array(); preg_replace_callback('#\<Placemark (.+?)\<\/name\>#msi', function($matches) { global $foundName; $ex = explode(">", $matches[1]); $foundName[] = end($ex); } , $text); preg_replace_callback('#\<coordinates\>(.+?)\<\/coordinates\>#msi', function($matches) { global $foundCoord; $foundCoord[] = $matches[1]; } , $text); return array("name" => $foundName, "coord" => $foundCoord);; } $d = parse($data); $res = ""; $counter = 0; foreach($d['name'] as $k => $v) { $name = $v; $point = explode(",", (string) $d['coord'][$k]); $out = "GMSMarker*marker" . $counter ++ . "= [[GMSMarker alloc] init]; \n"; $out .= "marker" . $counter . ".position = CLLocationCoordinate2DMake(" . $point[1] . "," . $point[0] ."); \n"; $out .= "marker" . $counter . ".title = @\"" . $name . "\"; \n"; $out .= "marker" . $counter . ".map = mapView_; \n"; $out .= "marker" . $counter . ".icon = [UIImage imageNamed:@\"wc.png\"]; \n \n"; $res .= $out; } echo '<textarea style="width:500px; height: 300px">' . $res . '</textarea>'; } ?> </body> </html>
Output for 5.3.0 - 7.1.0
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> </head> <body> <form method="post"> <textarea name="data" style="width: 100%; height: 300px"></textarea> <input type="submit"> </form> </body> </html>
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.2.17
Parse error: syntax error, unexpected T_FUNCTION in /in/FTfum on line 26
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1, 5.0.0 - 5.0.5
Parse error: parse error, unexpected T_FUNCTION in /in/FTfum on line 26
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/FTfum on line 26
Process exited with code 255.