3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $rsp = '{ "signature" = "AlHSJDRPuOhUBrIarX84l/YeP+ZpxYyd592/oyF7MkVYb/s13L2W8ag2C+PG0wSHPthbv9dNMBsG4TGg3aP7r7N+oa9Rsp9C3Qu03Z9b7PRzYM2KGXHDmOMk7vDpeMVlLDPSGYz1+U3sDxJzebSpbaJmT7imzUKfggEY7xxf4czfH0yj5wNzSGTOvQ=="; "purchase-info" = "ewoJIm9yaWdpbmFsLXB1cmNoYXNlLWRhdGUtcHN0IiA9ICIyMDE2LTAzLTIyIDEwOjUxOjAzIEFtZXJpY2EvTG9zX0Fucm9wYXRoLmZpcnN0IjsKCSJwdXJjaGFzZS1kYXRlLXBzdCIgP0wMy0yMiAxMDo1MTowMSBBbWVyaWNhL0xvc19BbmdlbGVzIjsKCSJxdWFudGl0eSIgPSAiMSI7Cn0="; "environment" = "Sandbox"; "pod" = "100"; "signing-status" = "0"; }'; preg_match_all('/"(.*)" = "(.*)";/mi', $rsp, $matches); var_dump($matches); $array = array(); for($i = 0; $i < count($matches[1]); $i++) { $array[$matches[1][$i]] = $matches[1][$i]; } var_dump($array);
based on Llr4j
Output for 5.5.0 - 7.1.10
array(3) { [0]=> array(5) { [0]=> string(205) ""signature" = "AlHSJDRPuOhUBrIarX84l/YeP+ZpxYyd592/oyF7MkVYb/s13L2W8ag2C+PG0wSHPthbv9dNMBsG4TGg3aP7r7N+oa9Rsp9C3Qu03Z9b7PRzYM2KGXHDmOMk7vDpeMVlLDPSGYz1+U3sDxJzebSpbaJmT7imzUKfggEY7xxf4czfH0yj5wNzSGTOvQ==";" [1]=> string(240) ""purchase-info" = "ewoJIm9yaWdpbmFsLXB1cmNoYXNlLWRhdGUtcHN0IiA9ICIyMDE2LTAzLTIyIDEwOjUxOjAzIEFtZXJpY2EvTG9zX0Fucm9wYXRoLmZpcnN0IjsKCSJwdXJjaGFzZS1kYXRlLXBzdCIgP0wMy0yMiAxMDo1MTowMSBBbWVyaWNhL0xvc19BbmdlbGVzIjsKCSJxdWFudGl0eSIgPSAiMSI7Cn0=";" [2]=> string(26) ""environment" = "Sandbox";" [3]=> string(14) ""pod" = "100";" [4]=> string(23) ""signing-status" = "0";" } [1]=> array(5) { [0]=> string(9) "signature" [1]=> string(13) "purchase-info" [2]=> string(11) "environment" [3]=> string(3) "pod" [4]=> string(14) "signing-status" } [2]=> array(5) { [0]=> string(188) "AlHSJDRPuOhUBrIarX84l/YeP+ZpxYyd592/oyF7MkVYb/s13L2W8ag2C+PG0wSHPthbv9dNMBsG4TGg3aP7r7N+oa9Rsp9C3Qu03Z9b7PRzYM2KGXHDmOMk7vDpeMVlLDPSGYz1+U3sDxJzebSpbaJmT7imzUKfggEY7xxf4czfH0yj5wNzSGTOvQ==" [1]=> string(219) "ewoJIm9yaWdpbmFsLXB1cmNoYXNlLWRhdGUtcHN0IiA9ICIyMDE2LTAzLTIyIDEwOjUxOjAzIEFtZXJpY2EvTG9zX0Fucm9wYXRoLmZpcnN0IjsKCSJwdXJjaGFzZS1kYXRlLXBzdCIgP0wMy0yMiAxMDo1MTowMSBBbWVyaWNhL0xvc19BbmdlbGVzIjsKCSJxdWFudGl0eSIgPSAiMSI7Cn0=" [2]=> string(7) "Sandbox" [3]=> string(3) "100" [4]=> string(1) "0" } } array(5) { ["signature"]=> string(9) "signature" ["purchase-info"]=> string(13) "purchase-info" ["environment"]=> string(11) "environment" ["pod"]=> string(3) "pod" ["signing-status"]=> string(14) "signing-status" }