3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php public function AttrFromString($string) { preg_match_all('/(\S+)=["\']?((?:.(?!["\']?\s+(?:\S+)=|[>"\']))+.)["\']?/', $string, $matches); var_dump($matches); $items = explode(" ", $string); $newlist = array(); foreach($items as $yes) { if (strpos($yes, "=")!==false) { $as = explode('=', $yes); } else { $as[0] = $yes; $as[1] = ""; } if (substr($as[1], 0,1) == "'" || substr($as[1], 0,1) == '"') { $as[1] = substr($as[1],1,strlen($as[1])-2); } } } AttrFromString("test=hallo tes2=\"doei\" test3='lol'");
Output for 5.4.0 - 5.4.15
Parse error: syntax error, unexpected 'public' (T_PUBLIC) in /in/SdW81 on line 2
Process exited with code 255.
Output for 5.3.0 - 5.3.25
Parse error: syntax error, unexpected T_PUBLIC in /in/SdW81 on line 2
Process exited with code 255.