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); $final_array = array_map(function($v){ $a = explode("=",$v); return array($a[0] => $a[1]);},$arr); print_r($final_array);
Output for 5.5.24 - 5.5.35, 5.6.8 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.25, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.4, 8.3.6
Array ( [0] => Array ( [txn_status] => 0 ) [1] => Array ( [txn_msg] => success ) [2] => Array ( [txn_err_msg] => NA ) [3] => Array ( [clnt_txn_ref] => 969239 ) [4] => Array ( [tpsl_bank_cd] => 470 ) [5] => Array ( [tpsl_txn_id] => 192630337 ) [6] => Array ( [txn_amt] => 1.00 ) [7] => Array ( [clnt_rqst_meta] => {itc:NIC~TXN0001~122333~rt14154~8 mar 2014~Payment~forpayment}{custname:test} ) [8] => Array ( [tpsl_txn_time] => 26-12-2015 15:56:20 ) [9] => Array ( [tpsl_rfnd_id] => NA ) [10] => Array ( [bal_amt] => NA ) [11] => Array ( [rqst_token] => hdfs-df-jkfhskjfhsjkd ) [12] => Array ( [hash] => jhdsfs54367jhf ) )
Output for 8.3.5
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0 Array ( [0] => Array ( [txn_status] => 0 ) [1] => Array ( [txn_msg] => success ) [2] => Array ( [txn_err_msg] => NA ) [3] => Array ( [clnt_txn_ref] => 969239 ) [4] => Array ( [tpsl_bank_cd] => 470 ) [5] => Array ( [tpsl_txn_id] => 192630337 ) [6] => Array ( [txn_amt] => 1.00 ) [7] => Array ( [clnt_rqst_meta] => {itc:NIC~TXN0001~122333~rt14154~8 mar 2014~Payment~forpayment}{custname:test} ) [8] => Array ( [tpsl_txn_time] => 26-12-2015 15:56:20 ) [9] => Array ( [tpsl_rfnd_id] => NA ) [10] => Array ( [bal_amt] => NA ) [11] => Array ( [rqst_token] => hdfs-df-jkfhskjfhsjkd ) [12] => Array ( [hash] => jhdsfs54367jhf ) )

preferences:
171.98 ms | 404 KiB | 198 Q