Skip to content

Instantly share code, notes, and snippets.

@trickymast3r
Last active March 7, 2024 08:38
Show Gist options
  • Save trickymast3r/e87578df298b196a0b17 to your computer and use it in GitHub Desktop.
Save trickymast3r/e87578df298b196a0b17 to your computer and use it in GitHub Desktop.
PHP Function Parse .dict to array
function parseDict($str) {
preg_match_all("/<key>(.*)<\/key>.*(<false\/>|<true\/>|<.*>(.*)<\/.*>)/iUs",$str,$m);
$parsedInfo = array();
foreach($m[0] as $k=>$v) {
$parsedInfo[$m[1][$k]] = trim($m[3][$k]);
}
return $parsedInfo;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment