3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = "txn_status=0|txn_msg=success|txn_err_msg=NA|clnt_txn_ref=969239|tpsl_bank_cd=470|tpsl_txn_id=192630337|txn_amt=1.00|clnt_rqst_meta={itc:NIC~TXN0001~122333~rt14154~8 mar 2014~Payment~forpayment}{custname:test}|tpsl_txn_time=26-12-2015 15:56:20|tpsl_rfnd_id=NA|bal_amt=NA|rqst_token=hdfs-df-jkfhskjfhsjkd|hash=jhdsfs54367jhf"; $arr = explode("|", $string); foreach ($arr as $key => $value) { $newArr = explode("=", $value); $myRequiredArr[$newArr[0]] = $newArr[1]; } echo "<pre>"; print_r($myRequiredArr);$string = "txn_status=0|txn_msg=success|txn_err_msg=NA|clnt_txn_ref=969239|tpsl_bank_cd=470|tpsl_txn_id=192630337|txn_amt=1.00|clnt_rqst_meta={itc:NIC~TXN0001~122333~rt14154~8 mar 2014~Payment~forpayment}{custname:test}|tpsl_txn_time=26-12-2015 15:56:20|tpsl_rfnd_id=NA|bal_amt=NA|rqst_token=hdfs-df-jkfhskjfhsjkd|hash=jhdsfs54367jhf"; $arr = call_user_func_array('array_merge',array_map(function($v){ $a = explode("=",$v); return array($a[0] => $a[1]);},explode('|',$string))); print_r($arr);
Output for git.master, git.master_jit, rfc.property-hooks
<pre>Array ( [txn_status] => 0 [txn_msg] => success [txn_err_msg] => NA [clnt_txn_ref] => 969239 [tpsl_bank_cd] => 470 [tpsl_txn_id] => 192630337 [txn_amt] => 1.00 [clnt_rqst_meta] => {itc:NIC~TXN0001~122333~rt14154~8 mar 2014~Payment~forpayment}{custname:test} [tpsl_txn_time] => 26-12-2015 15:56:20 [tpsl_rfnd_id] => NA [bal_amt] => NA [rqst_token] => hdfs-df-jkfhskjfhsjkd [hash] => jhdsfs54367jhf ) Array ( [txn_status] => 0 [txn_msg] => success [txn_err_msg] => NA [clnt_txn_ref] => 969239 [tpsl_bank_cd] => 470 [tpsl_txn_id] => 192630337 [txn_amt] => 1.00 [clnt_rqst_meta] => {itc:NIC~TXN0001~122333~rt14154~8 mar 2014~Payment~forpayment}{custname:test} [tpsl_txn_time] => 26-12-2015 15:56:20 [tpsl_rfnd_id] => NA [bal_amt] => NA [rqst_token] => hdfs-df-jkfhskjfhsjkd [hash] => jhdsfs54367jhf )

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:
47.59 ms | 403 KiB | 8 Q