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[0]); //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 = 24, Position 2 = 32
Branch analysis from position: 24
2 jumps found. (Code = 78) Position 1 = 25, Position 2 = 32
Branch analysis from position: 25
1 jumps found. (Code = 42) Position 1 = 24
Branch analysis from position: 24
Branch analysis from position: 32
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 32
filename:       /in/v2H0l
function name:  (null)
number of ops:  34
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        FETCH_DIM_R                                      ~14     !3, 0
         21        SEND_VAL                                                 ~14
         22        DO_ICALL                                                 
   14    23      > FE_RESET_R                                       $16     !2, ->32
         24    > > FE_FETCH_R                                               $16, !4, ->32
   16    25    >   INIT_FCALL                                               'json_decode'
         26        SEND_VAR                                                 !3
         27        SEND_VAL                                                 <true>
         28        DO_ICALL                                         $17     
         29        CAST                                          7  ~18     $17
         30        ASSIGN                                                   !5, ~18
   14    31      > JMP                                                      ->24
         32    >   FE_FREE                                                  $16
   19    33      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
173.98 ms | 1396 KiB | 23 Q