- Output for 5.3.0 - 5.3.25, 5.4.0 - 5.4.15
- Parse error: syntax error, unexpected '}' in /in/rUDlH on line 12
Process exited with code 255.
<?php
function AttrFromString($string) {
preg_match_all('/(\S+)=["\']?((?:.(?!["\']?\s+(?:\S+)=|[>"\']))+.)["\']?|(\S+)/', $string, $matches);
$newlist = array();
for($i = 0; $i < count($matches[0]); $i++) {
if (!empty($matches[1][$i])) {
array_push($newlist, array($matches[1][$i] , $matches[2][$i]));
}
}
}
var_dump($newlist);
}
AttrFromString("test=hallo tes2=\"doei\" test3='lol' no-pe ja test='niks'");