3v4l.org

run code in 300+ PHP versions simultaneously
<?php $shipmentDet = '{"{\"Coupon\": \"\", \"PromotionName\": \"FREE Tighty Wifey\", \"DiscountAmount\": 23.75}","{\"Coupon\": \"get20\", \"PromotionName\": \"GET20\", \"DiscountAmount\": 20}"}'; $newString = str_replace('","', '"},~;{"', $shipmentDet); $explore = explode(',~;', $newString); $decode = substr($explore[0], 1, -1); print_r($decode); //print_r($explore); foreach ($explore as $cpnItm) { $json_decoder = (array)json_decode($decode,true); //print_r($json_decoder[0]); // print_r($json_decoder[0]['PromotionName']); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 23, Position 2 = 31
Branch analysis from position: 23
2 jumps found. (Code = 78) Position 1 = 24, Position 2 = 31
Branch analysis from position: 24
1 jumps found. (Code = 42) Position 1 = 23
Branch analysis from position: 23
Branch analysis from position: 31
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 31
filename:       /in/tI4JW
function name:  (null)
number of ops:  33
compiled vars:  !0 = $shipmentDet, !1 = $newString, !2 = $explore, !3 = $decode, !4 = $cpnItm, !5 = $json_decoder
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%7B%22%7B%5C%22Coupon%5C%22%3A+%5C%22%5C%22%2C+%5C%22PromotionName%5C%22%3A+%5C%22FREE+Tighty+Wifey%5C%22%2C+%5C%22DiscountAmount%5C%22%3A+23.75%7D%22%2C%22%7B%5C%22Coupon%5C%22%3A+%5C%22get20%5C%22%2C+%5C%22PromotionName%5C%22%3A+%5C%22GET20%5C%22%2C+%5C%22DiscountAmount%5C%22%3A+20%7D%22%7D'
    7     1        INIT_FCALL                                               'str_replace'
          2        SEND_VAL                                                 '%22%2C%22'
          3        SEND_VAL                                                 '%22%7D%2C%7E%3B%7B%22'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $7      
          6        ASSIGN                                                   !1, $7
    9     7        INIT_FCALL                                               'explode'
          8        SEND_VAL                                                 '%2C%7E%3B'
          9        SEND_VAR                                                 !1
         10        DO_ICALL                                         $9      
         11        ASSIGN                                                   !2, $9
   10    12        INIT_FCALL                                               'substr'
         13        FETCH_DIM_R                                      ~11     !2, 0
         14        SEND_VAL                                                 ~11
         15        SEND_VAL                                                 1
         16        SEND_VAL                                                 -1
         17        DO_ICALL                                         $12     
         18        ASSIGN                                                   !3, $12
   11    19        INIT_FCALL                                               'print_r'
         20        SEND_VAR                                                 !3
         21        DO_ICALL                                                 
   14    22      > FE_RESET_R                                       $15     !2, ->31
         23    > > FE_FETCH_R                                               $15, !4, ->31
   16    24    >   INIT_FCALL                                               'json_decode'
         25        SEND_VAR                                                 !3
         26        SEND_VAL                                                 <true>
         27        DO_ICALL                                         $16     
         28        CAST                                          7  ~17     $16
         29        ASSIGN                                                   !5, ~17
   14    30      > JMP                                                      ->23
         31    >   FE_FREE                                                  $15
   19    32      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
176.54 ms | 1396 KiB | 23 Q