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);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 7, Position 2 = 19
Branch analysis from position: 7
2 jumps found. (Code = 78) Position 1 = 8, Position 2 = 19
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 19
filename:       /in/aphlv
function name:  (null)
number of ops:  43
compiled vars:  !0 = $string, !1 = $arr, !2 = $value, !3 = $key, !4 = $newArr, !5 = $myRequiredArr
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'txn_status%3D0%7Ctxn_msg%3Dsuccess%7Ctxn_err_msg%3DNA%7Cclnt_txn_ref%3D969239%7Ctpsl_bank_cd%3D470%7Ctpsl_txn_id%3D192630337%7Ctxn_amt%3D1.00%7Cclnt_rqst_meta%3D%7Bitc%3ANIC%7ETXN0001%7E122333%7Ert14154%7E8+mar+2014%7EPayment%7Eforpayment%7D%7Bcustname%3Atest%7D%7Ctpsl_txn_time%3D26-12-2015+15%3A56%3A20%7Ctpsl_rfnd_id%3DNA%7Cbal_amt%3DNA%7Crqst_token%3Dhdfs-df-jkfhskjfhsjkd%7Chash%3Djhdsfs54367jhf'
    4     1        INIT_FCALL                                               'explode'
          2        SEND_VAL                                                 '%7C'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $7      
          5        ASSIGN                                                   !1, $7
    5     6      > FE_RESET_R                                       $9      !1, ->19
          7    > > FE_FETCH_R                                       ~10     $9, !2, ->19
          8    >   ASSIGN                                                   !3, ~10
    6     9        INIT_FCALL                                               'explode'
         10        SEND_VAL                                                 '%3D'
         11        SEND_VAR                                                 !2
         12        DO_ICALL                                         $12     
         13        ASSIGN                                                   !4, $12
    7    14        FETCH_DIM_R                                      ~14     !4, 0
         15        FETCH_DIM_R                                      ~16     !4, 1
         16        ASSIGN_DIM                                               !5, ~14
         17        OP_DATA                                                  ~16
    5    18      > JMP                                                      ->7
         19    >   FE_FREE                                                  $9
   10    20        ECHO                                                     '%3Cpre%3E'
   11    21        INIT_FCALL                                               'print_r'
         22        SEND_VAR                                                 !5
         23        DO_ICALL                                                 
         24        ASSIGN                                                   !0, 'txn_status%3D0%7Ctxn_msg%3Dsuccess%7Ctxn_err_msg%3DNA%7Cclnt_txn_ref%3D969239%7Ctpsl_bank_cd%3D470%7Ctpsl_txn_id%3D192630337%7Ctxn_amt%3D1.00%7Cclnt_rqst_meta%3D%7Bitc%3ANIC%7ETXN0001%7E122333%7Ert14154%7E8+mar+2014%7EPayment%7Eforpayment%7D%7Bcustname%3Atest%7D%7Ctpsl_txn_time%3D26-12-2015+15%3A56%3A20%7Ctpsl_rfnd_id%3DNA%7Cbal_amt%3DNA%7Crqst_token%3Dhdfs-df-jkfhskjfhsjkd%7Chash%3Djhdsfs54367jhf'
   12    25        INIT_FCALL                                               'array_merge'
         26        INIT_FCALL                                               'array_map'
         27        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2Faphlv%3A12%240'
         28        SEND_VAL                                                 ~19
         29        INIT_FCALL                                               'explode'
         30        SEND_VAL                                                 '%7C'
         31        SEND_VAR                                                 !0
         32        DO_ICALL                                         $20     
         33        SEND_VAR                                                 $20
         34        DO_ICALL                                         $21     
         35        SEND_ARRAY                                               $21
         36        CHECK_UNDEF_ARGS                                         
         37        DO_FCALL                                      0  $22     
         38        ASSIGN                                                   !1, $22
   13    39        INIT_FCALL                                               'print_r'
         40        SEND_VAR                                                 !1
         41        DO_ICALL                                                 
         42      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2Faphlv%3A12%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/aphlv
function name:  {closure}
number of ops:  11
compiled vars:  !0 = $v, !1 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   RECV                                             !0      
          1        INIT_FCALL                                               'explode'
          2        SEND_VAL                                                 '%3D'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $2      
          5        ASSIGN                                                   !1, $2
          6        FETCH_DIM_R                                      ~4      !1, 0
          7        FETCH_DIM_R                                      ~5      !1, 1
          8        INIT_ARRAY                                       ~6      ~5, ~4
          9      > RETURN                                                   ~6
         10*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2Faphlv%3A12%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
163.44 ms | 1405 KiB | 21 Q