push
当我们将它变成一个数组时,我们不想丢失像transactionid=67002 msisdn=12136018066 destination_msisdn=12136018066 country=Canada countryid=701 operator=1Canada operatorid=2350 reference_operator= originating_currency=CAD destination_currency=CAD product_requested=3 actual_product_sent=3 wholesale_price=3.61 retail_price=3.70 balance=9.96 sms_sent=no sms= cid1= cid2= cid3= pin_based=yes pin_option_1=key in : *105* (top-up code) # (press call button) pin_option_2=Click the WIND icon on your phone pin_option_3=to access the menu, and top up in a few quick steps pin_value=3 pin_code=9973 44700 7583 pin_ivr= pin_serial=5500000008 pin_validity=365 authentication_key=1455826552 error_code=0 error_txt=Transaction Good
这样的值,这些值在数据中有空格,就像字符串的分隔符一样,也是一个空格。到目前为止,这是我的代码:
pin_code
答案 0 :(得分:0)
正则表达式的乐趣:
$regex = '/(\w+)=((?:.(?!\w+=))+)/';
preg_match_all($regex, $str, $matches, PREG_SET_ORDER);
var_dump($matches);
如果您有PHP 5.5或更高版本,您可以将此樱桃放在顶部(底部)
$values = array_combine(array_column($matches, 1), array_column($matches, 2));
var_cump($values);
答案 1 :(得分:0)
以下方法对我有用:
tintAdjustmentView