3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $shipmentDet = '{"{\"Coupon\": \"\", \"PromotionName\": \"FREE Tighty Wifey\", \"DiscountAmount\": 23.75}","{\"Coupon\": \"get20\", \"PromotionName\": \"GET20\", \"DiscountAmount\": 20}"}'; $newString = str_replace('","', '"},~;{"', $shipmentDet); $explore = explode(',~;', $newString); $decode = substr($explore[0], 1, -1); print_r($decode); //print_r($explore); foreach ($explore as $cpnItm) { $json_decoder = (array)json_decode($decode,true); //print_r($json_decoder[0]); // print_r($json_decoder[0]['PromotionName']); }
based on v2H0l
Output for 5.5.0 - 7.3.0rc4
"{\"Coupon\": \"\", \"PromotionName\": \"FREE Tighty Wifey\", \"DiscountAmount\": 23.75}"