3v4l.org

run code in 300+ PHP versions simultaneously
<!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 - 5.3.29, 5.4.0 - 5.4.45, 5.5.24 - 5.5.35, 5.6.8 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.25, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
<!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.1.6, 5.2.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.3.11, 4.4.0 - 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.

preferences:
251.71 ms | 401 KiB | 328 Q