3v4l.org

run code in 300+ PHP versions simultaneously
<?php $json = <<<JSON { "ResultType": "0", "ResultCode": "0", "TransactionID": "LIB76ANQYD", "ResultParameters": { "ResultParameter": [ { "Key": "TransactionAmount", "Value": "750" }, { "Key": "TransactionReceipt", "Value": "LIB76ANQYD" }, { "Key": "ReceiverPartyPublicName", "Value": "345706611796 - PETER Parr" } ] }, "ReferenceData": { "ReferenceItem": { "Key": "QueueURL", "Value": "http://xxxxxx" } } } JSON; foreach (json_decode($json, true)['ResultParameters']['ResultParameter'] as $parameter) { if ($parameter['Key'] === 'TransactionAmount') { echo 'TransactionAmount: ' . $parameter['Value'] . PHP_EOL; } if ($parameter['Key'] === 'ReceiverPartyPublicName') { echo 'ReceiverPartyPublicName: ' . $parameter['Value'] . PHP_EOL; } }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 8, Position 2 = 24
Branch analysis from position: 8
2 jumps found. (Code = 78) Position 1 = 9, Position 2 = 24
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 16
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 19, Position 2 = 23
Branch analysis from position: 19
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 23
Branch analysis from position: 16
Branch analysis from position: 24
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 24
filename:       /in/CaPWL
function name:  (null)
number of ops:  26
compiled vars:  !0 = $json, !1 = $parameter
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%7B%0A++%22ResultType%22%3A+%220%22%2C%0A++%22ResultCode%22%3A+%220%22%2C%0A++%22TransactionID%22%3A+%22LIB76ANQYD%22%2C%0A++%22ResultParameters%22%3A+%7B%0A++++%22ResultParameter%22%3A+%5B%0A++++++%7B%0A++++++++%22Key%22%3A+%22TransactionAmount%22%2C%0A++++++++%22Value%22%3A+%22750%22%0A++++++%7D%2C%0A++++++%7B%0A++++++++%22Key%22%3A+%22TransactionReceipt%22%2C%0A++++++++%22Value%22%3A+%22LIB76ANQYD%22%0A++++++%7D%2C%0A++++++%7B%0A++++++++%22Key%22%3A+%22ReceiverPartyPublicName%22%2C%0A++++++++%22Value%22%3A+%22345706611796+-+PETER+Parr%22%0A++++++%7D%0A++++%5D%0A++%7D%2C%0A++%22ReferenceData%22%3A+%7B%0A++++%22ReferenceItem%22%3A+%7B%0A++++++%22Key%22%3A+%22QueueURL%22%2C%0A++++++%22Value%22%3A+%22http%3A%2F%2Fxxxxxx%22%0A++++%7D%0A++%7D%0A%7D'
   33     1        INIT_FCALL                                               'json_decode'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 <true>
          4        DO_ICALL                                         $3      
          5        FETCH_DIM_R                                      ~4      $3, 'ResultParameters'
          6        FETCH_DIM_R                                      ~5      ~4, 'ResultParameter'
          7      > FE_RESET_R                                       $6      ~5, ->24
          8    > > FE_FETCH_R                                               $6, !1, ->24
   34     9    >   FETCH_DIM_R                                      ~7      !1, 'Key'
         10        IS_IDENTICAL                                             ~7, 'TransactionAmount'
         11      > JMPZ                                                     ~8, ->16
   35    12    >   FETCH_DIM_R                                      ~9      !1, 'Value'
         13        CONCAT                                           ~10     'TransactionAmount%3A+', ~9
         14        CONCAT                                           ~11     ~10, '%0A'
         15        ECHO                                                     ~11
   37    16    >   FETCH_DIM_R                                      ~12     !1, 'Key'
         17        IS_IDENTICAL                                             ~12, 'ReceiverPartyPublicName'
         18      > JMPZ                                                     ~13, ->23
   38    19    >   FETCH_DIM_R                                      ~14     !1, 'Value'
         20        CONCAT                                           ~15     'ReceiverPartyPublicName%3A+', ~14
         21        CONCAT                                           ~16     ~15, '%0A'
         22        ECHO                                                     ~16
   33    23    > > JMP                                                      ->8
         24    >   FE_FREE                                                  $6
   40    25      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
145.04 ms | 1401 KiB | 15 Q