<?php
$string = 'paypal_merchant_email="sample@ymail.com"|paypal_verified_only="0"|payment_currency=""|sandbox="1"|sandbox_merchant_email="sample@ymail.com"|payment_logos=""|debug="0"|status_pending="W"|status_success="O"|status_canceled="D"|countries=""|min_amount="0"|max_amount="0"|secure_post=""|ipn_test=""|no_shipping="0"|address_override="0"|cost_per_transaction="0"|cost_percent_total="0"|tax_id=0|';
preg_match_all('/\|(.*?)="(.*?)"/', '|'.$string, $matches);
$result = array_combine($matches[1], $matches[2]);
print_r($result);
- Output for 5.6.0 - 5.6.40, 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.30, 8.2.0 - 8.2.25, 8.3.0 - 8.3.13
- Array
(
[paypal_merchant_email] => sample@ymail.com
[paypal_verified_only] => 0
[payment_currency] =>
[sandbox] => 1
[sandbox_merchant_email] => sample@ymail.com
[payment_logos] =>
[debug] => 0
[status_pending] => W
[status_success] => O
[status_canceled] => D
[countries] =>
[min_amount] => 0
[max_amount] => 0
[secure_post] =>
[ipn_test] =>
[no_shipping] => 0
[address_override] => 0
[cost_per_transaction] => 0
[cost_percent_total] => 0
)
preferences:
86.77 ms | 409 KiB | 5 Q