Anonymous
public php v1 · immutable<?phpfunction conv_attr ($s){ if (!strlen($s)) return false; //explode(" ", $s) -- will broken at "with space value" //explode("=", $s) -- broken at e="hello=world" return $o; }$attr='a="a.value" b="with space value" c=\'single quote\' d=without_quote e="hello=world"';/* expected result: $r=array( 'a'=>'a.value', 'b'=>'with space value', 'c'=>'single quote', 'd'=>'without_quote', 'e'=>'hello=world' );*/$r=conv_attr($attr);print_r($r);?>