3v4l.org

run code in 300+ PHP versions simultaneously
<?php $json = <<<EOD {"info":{"orderid":"166","order_code":"7b601857-af5a-4487-865d-21683ae5dd6b","pay_summ":"70.58","comiss":"4.76","total_summ":"75.34","segment":{"ticket":"\u042362-\u04151-5291440-0608","creation_time":"06.08.2013 15:55:52","num":"1","tot_price":"06.08.2013 15:55:52","tax":"06.08.2013 15:55:52","transporte_type":"2","places":[{"car_num":"04","car_type":"1020","loc_num":"02"}]}},"data":{"version":"1.0.0","orderid":"166","merrespurl":"http:\/\/tickets.nikita.dev\/ecommerce\/liqpay","merid":"I0110DQX","acqid":"414963","purchaseamt":"000000007534","purchasecurrencyexponent":2,"purchasecurrency":"980","orderdescription":"Ticket purchase from http:\/\/privatbank.ua\/","signature":"MAfxoGuJ2FY8GIPdfES1k\/55IBU="},"condition":"9869626e88933abb30fe5d7bd317e826","status":"yes"} EOD; class Helper { function objectToArray($d) { if (is_object($d)) { // Gets the properties of the given object // with get_object_vars function $d = get_object_vars($d); } if (is_array($d)) { /* * Return array converted to object * Using __FUNCTION__ (Magic constant) * for recursive call */ return array_map(__METHOD__, $d); } else { // Return array return $d; } } } $helper = new Helper; var_dump($helper->objectToArray(json_decode($json)));
Output for git.master, git.master_jit, rfc.property-hooks
array(4) { ["info"]=> array(6) { ["orderid"]=> string(3) "166" ["order_code"]=> string(36) "7b601857-af5a-4487-865d-21683ae5dd6b" ["pay_summ"]=> string(5) "70.58" ["comiss"]=> string(4) "4.76" ["total_summ"]=> string(5) "75.34" ["segment"]=> array(7) { ["ticket"]=> string(21) "У62-Е1-5291440-0608" ["creation_time"]=> string(19) "06.08.2013 15:55:52" ["num"]=> string(1) "1" ["tot_price"]=> string(19) "06.08.2013 15:55:52" ["tax"]=> string(19) "06.08.2013 15:55:52" ["transporte_type"]=> string(1) "2" ["places"]=> array(1) { [0]=> array(3) { ["car_num"]=> string(2) "04" ["car_type"]=> string(4) "1020" ["loc_num"]=> string(2) "02" } } } } ["data"]=> array(10) { ["version"]=> string(5) "1.0.0" ["orderid"]=> string(3) "166" ["merrespurl"]=> string(42) "http://tickets.nikita.dev/ecommerce/liqpay" ["merid"]=> string(8) "I0110DQX" ["acqid"]=> string(6) "414963" ["purchaseamt"]=> string(12) "000000007534" ["purchasecurrencyexponent"]=> int(2) ["purchasecurrency"]=> string(3) "980" ["orderdescription"]=> string(42) "Ticket purchase from http://privatbank.ua/" ["signature"]=> string(28) "MAfxoGuJ2FY8GIPdfES1k/55IBU=" } ["condition"]=> string(32) "9869626e88933abb30fe5d7bd317e826" ["status"]=> string(3) "yes" }

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
49.21 ms | 405 KiB | 8 Q