Last active
March 7, 2024 08:38
-
-
Save trickymast3r/e87578df298b196a0b17 to your computer and use it in GitHub Desktop.
PHP Function Parse .dict to array
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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