3v4l.org

run code in 300+ PHP versions simultaneously
<?php $response = json_encode([ "success" => true, "quoteId" => 11, "abcValue" => 0, "priceResponse" => [ [ "priceId" => 1263, "fPrice" => 37.14, "grossPrice" => 44.7, "priceType" => "ABC", ], [ "priceId" => 1263, "fPrice" => 37.14, "grossPrice" => 44.7, "priceType" => "ABC", ], [ "priceId" => 1266, "fPrice" => 550.14, "grossPrice" => 544.7, "priceType" => "DEF", ], ], ]); $object = json_decode($response); $object = (object)[ 'success' => $object->success, 'quoteId' => $object->quoteId, 'priceResponse' => array_map( fn($item) => [ 'priceId' => $item->priceId, 'customPrice' => $item->grossPrice * 1.1, ], $object->priceResponse ) ]; print_r($object);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MUeHZ
function name:  (null)
number of ops:  25
compiled vars:  !0 = $response, !1 = $object
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'json_encode'
    4     1        SEND_VAL                                                 <array>
    3     2        DO_ICALL                                         $2      
          3        ASSIGN                                                   !0, $2
   29     4        INIT_FCALL                                               'json_decode'
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                         $4      
          7        ASSIGN                                                   !1, $4
   32     8        FETCH_OBJ_R                                      ~6      !1, 'success'
          9        INIT_ARRAY                                       ~7      ~6, 'success'
   33    10        FETCH_OBJ_R                                      ~8      !1, 'quoteId'
         11        ADD_ARRAY_ELEMENT                                ~7      ~8, 'quoteId'
   34    12        INIT_FCALL                                               'array_map'
   35    13        DECLARE_LAMBDA_FUNCTION                          ~9      [0]
   38    14        SEND_VAL                                                 ~9
   39    15        FETCH_OBJ_R                                      ~10     !1, 'priceResponse'
         16        SEND_VAL                                                 ~10
   34    17        DO_ICALL                                         $11     
   39    18        ADD_ARRAY_ELEMENT                                ~7      $11, 'priceResponse'
         19        CAST                                          8  ~12     ~7
   31    20        ASSIGN                                                   !1, ~12
   43    21        INIT_FCALL                                               'print_r'
         22        SEND_VAR                                                 !1
         23        DO_ICALL                                                 
         24      > RETURN                                                   1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MUeHZ
function name:  {closure}
number of ops:  8
compiled vars:  !0 = $item
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   35     0  E >   RECV                                             !0      
   36     1        FETCH_OBJ_R                                      ~1      !0, 'priceId'
          2        INIT_ARRAY                                       ~2      ~1, 'priceId'
   37     3        FETCH_OBJ_R                                      ~3      !0, 'grossPrice'
          4        MUL                                              ~4      ~3, 1.1
          5        ADD_ARRAY_ELEMENT                                ~2      ~4, 'customPrice'
          6      > RETURN                                                   ~2
   38     7*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
172.22 ms | 1014 KiB | 17 Q