3v4l.org

run code in 300+ PHP versions simultaneously
<?php $json = <<<EOD {"info":{"orderid":"166","order_code":"7b601857-af5a-4487-865d-21683ae5dd6b","pay_summ":"70.58","comiss":"4.76","total_summ":"75.34","segment":{"ticket":"\u042362-\u04151-5291440-0608","creation_time":"06.08.2013 15:55:52","num":"1","tot_price":"06.08.2013 15:55:52","tax":"06.08.2013 15:55:52","transporte_type":"2","places":[{"car_num":"04","car_type":"1020","loc_num":"02"}]}},"data":{"version":"1.0.0","orderid":"166","merrespurl":"http:\/\/tickets.nikita.dev\/ecommerce\/liqpay","merid":"I0110DQX","acqid":"414963","purchaseamt":"000000007534","purchasecurrencyexponent":2,"purchasecurrency":"980","orderdescription":"Ticket purchase from http:\/\/privatbank.ua\/","signature":"MAfxoGuJ2FY8GIPdfES1k\/55IBU="},"condition":"9869626e88933abb30fe5d7bd317e826","status":"yes"} EOD; class Helper { function objectToArray($d) { if (is_object($d)) { // Gets the properties of the given object // with get_object_vars function $d = get_object_vars($d); } if (is_array($d)) { /* * Return array converted to object * Using __FUNCTION__ (Magic constant) * for recursive call */ return array_map(__METHOD__, $d); } else { // Return array return $d; } } } $helper = new Helper; var_dump($helper->objectToArray(json_decode($json)));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/p1a8U
function name:  (null)
number of ops:  14
compiled vars:  !0 = $json, !1 = $helper
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, '%7B%22info%22%3A%7B%22orderid%22%3A%22166%22%2C%22order_code%22%3A%227b601857-af5a-4487-865d-21683ae5dd6b%22%2C%22pay_summ%22%3A%2270.58%22%2C%22comiss%22%3A%224.76%22%2C%22total_summ%22%3A%2275.34%22%2C%22segment%22%3A%7B%22ticket%22%3A%22%5Cu042362-%5Cu04151-5291440-0608%22%2C%22creation_time%22%3A%2206.08.2013+15%3A55%3A52%22%2C%22num%22%3A%221%22%2C%22tot_price%22%3A%2206.08.2013+15%3A55%3A52%22%2C%22tax%22%3A%2206.08.2013+15%3A55%3A52%22%2C%22transporte_type%22%3A%222%22%2C%22places%22%3A%5B%7B%22car_num%22%3A%2204%22%2C%22car_type%22%3A%221020%22%2C%22loc_num%22%3A%2202%22%7D%5D%7D%7D%2C%22data%22%3A%7B%22version%22%3A%221.0.0%22%2C%22orderid%22%3A%22166%22%2C%22merrespurl%22%3A%22http%3A%5C%2F%5C%2Ftickets.nikita.dev%5C%2Fecommerce%5C%2Fliqpay%22%2C%22merid%22%3A%22I0110DQX%22%2C%22acqid%22%3A%22414963%22%2C%22purchaseamt%22%3A%22000000007534%22%2C%22purchasecurrencyexponent%22%3A2%2C%22purchasecurrency%22%3A%22980%22%2C%22orderdescription%22%3A%22Ticket+purchase+from+http%3A%5C%2F%5C%2Fprivatbank.ua%5C%2F%22%2C%22signature%22%3A%22MAfxoGuJ2FY8GIPdfES1k%5C%2F55IBU%3D%22%7D%2C%22condition%22%3A%229869626e88933abb30fe5d7bd317e826%22%2C%22status%22%3A%22yes%22%7D'
   27     1        NEW                                              $3      'Helper'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !1, $3
   28     4        INIT_FCALL                                               'var_dump'
          5        INIT_METHOD_CALL                                         !1, 'objectToArray'
          6        INIT_FCALL                                               'json_decode'
          7        SEND_VAR                                                 !0
          8        DO_ICALL                                         $6      
          9        SEND_VAR_NO_REF_EX                                       $6
         10        DO_FCALL                                      0  $7      
         11        SEND_VAR                                                 $7
         12        DO_ICALL                                                 
         13      > RETURN                                                   1

Class Helper:
Function objecttoarray:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 7
Branch analysis from position: 3
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 15
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
filename:       /in/p1a8U
function name:  objectToArray
number of ops:  17
compiled vars:  !0 = $d
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
    7     1        TYPE_CHECK                                  256          !0
          2      > JMPZ                                                     ~1, ->7
   10     3    >   INIT_FCALL                                               'get_object_vars'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $2      
          6        ASSIGN                                                   !0, $2
   13     7    >   TYPE_CHECK                                  128          !0
          8      > JMPZ                                                     ~4, ->15
   19     9    >   INIT_FCALL                                               'array_map'
         10        SEND_VAL                                                 'Helper%3A%3AobjectToArray'
         11        SEND_VAR                                                 !0
         12        DO_ICALL                                         $5      
         13      > RETURN                                                   $5
         14*       JMP                                                      ->16
   23    15    > > RETURN                                                   !0
   25    16*     > RETURN                                                   null

End of function objecttoarray

End of class Helper.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
162.93 ms | 1400 KiB | 21 Q