Last active
October 8, 2015 09:50
-
-
Save di7spider/515bd0211e6d987c4c26 to your computer and use it in GitHub Desktop.
[PHP] Парсит параметризированную строку вида: "key1=value>key2=value>key3=value" в массив
This file contains hidden or 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
<?php | |
function parseParams($str) | |
{ | |
if( !empty($str) ){ | |
preg_match_all('/([^>=]+)=([^>=]+)?/', $str, $arOptions); | |
return array_combine($arOptions[1], $arOptions[2]); | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Пример использования: