3v4l.org

run code in 300+ PHP versions simultaneously
<?php class gardenObject implements JsonSerializable { public function jsonSerialize() { $data[] = $this->flowers; $data[] = $this->fruit; $data[] = $this->herbs; return $data; } } $garden = new gardenObject(); $garden->flowers = array("clematis", "geranium", "hydrangea"); $garden->herbs = array("mint", "sage", "chives", "rosemary"); $garden->fruit = array("apple", "rhubarb"); echo json_encode($garden1);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/FaTUG
function name:  (null)
number of ops:  15
compiled vars:  !0 = $garden, !1 = $garden1
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   DECLARE_CLASS                                            'gardenobject'
   11     1        NEW                                              $2      'gardenObject'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $2
   12     4        ASSIGN_OBJ                                               !0, 'flowers'
          5        OP_DATA                                                  <array>
   13     6        ASSIGN_OBJ                                               !0, 'herbs'
          7        OP_DATA                                                  <array>
   14     8        ASSIGN_OBJ                                               !0, 'fruit'
          9        OP_DATA                                                  <array>
   15    10        INIT_FCALL                                               'json_encode'
         11        SEND_VAR                                                 !1
         12        DO_ICALL                                         $8      
         13        ECHO                                                     $8
         14      > RETURN                                                   1

Class gardenObject:
Function jsonserialize:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/FaTUG
function name:  jsonSerialize
number of ops:  11
compiled vars:  !0 = $data
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   FETCH_OBJ_R                                      ~2      'flowers'
          1        ASSIGN_DIM                                               !0
          2        OP_DATA                                                  ~2
    6     3        FETCH_OBJ_R                                      ~4      'fruit'
          4        ASSIGN_DIM                                               !0
          5        OP_DATA                                                  ~4
    7     6        FETCH_OBJ_R                                      ~6      'herbs'
          7        ASSIGN_DIM                                               !0
          8        OP_DATA                                                  ~6
    8     9      > RETURN                                                   !0
    9    10*     > RETURN                                                   null

End of function jsonserialize

End of class gardenObject.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
158.6 ms | 1387 KiB | 15 Q