3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = '{"Body": {"stkCallback": {"MerchantRequestID":"26452-605723-2","CheckoutRequestID":"ws_CO_23042018105859659","ResultCode":0,"ResultDesc":"The service request is processed successfully.","CallbackMetadata": {"Item":[{"Name":"Amount","Value":1.00},{"Name":"MpesaReceiptNumber","Value":"MDN6ZJE4XG"},{"Name":"Balance"},{"Name":"TransactionDate","Value":20180423105912},{"Name":"PhoneNumber","Value":254722200121}]}}}}'; $arr = json_decode($str,true); echo $arr['Body']['stkCallback']['MerchantRequestID'] . "\n"; // Working //echo $arr['Body']['stkCallback']['CallbackMetadata'] . "\n"; echo $arr['Body']['stkCallback']['CallbackMetadata']['Item'][1]['Value'] . "\n"; echo $arr['Body']['stkCallback']['CallbackMetadata']['Item'][3]['Value'] . "\n"; echo $arr['Body']['stkCallback']['CallbackMetadata']['Item'][4]['Value'] . "\n"; echo $arr['Body']['stkCallback']['CallbackMetadata']['Item'][0]['Value'] ."\n"; /*Foreach($arr['Body']['stkCallback']['CallbackMetadata']['Item'] as $subarr){ Foreach($subarr as $item){ Echo $item ."\n"; } } */
Output for git.master, git.master_jit, rfc.property-hooks
26452-605723-2 MDN6ZJE4XG 20180423105912 254722200121 1

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:
27.89 ms | 405 KiB | 5 Q