3v4l.org

run code in 300+ PHP versions simultaneously
<?php class ArrayValue implements JsonSerializable { public function __construct(array $array) { $this->array = $array; } public function jsonSerialize(): mixed { return $this->array; } } $array = ['foo' => 'bar', 'quux' => 'baz']; echo json_encode(new ArrayValue($array), JSON_PRETTY_PRINT);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/gqeus
function name:  (null)
number of ops:  11
compiled vars:  !0 = $array
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   DECLARE_CLASS                                            'arrayvalue'
   13     1        ASSIGN                                                   !0, <array>
   14     2        INIT_FCALL                                               'json_encode'
          3        NEW                                              $2      'ArrayValue'
          4        SEND_VAR_EX                                              !0
          5        DO_FCALL                                      0          
          6        SEND_VAR                                                 $2
          7        SEND_VAL                                                 128
          8        DO_ICALL                                         $4      
          9        ECHO                                                     $4
         10      > RETURN                                                   1

Class ArrayValue:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/gqeus
function name:  __construct
number of ops:  4
compiled vars:  !0 = $array
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
    5     1        ASSIGN_OBJ                                               'array'
          2        OP_DATA                                                  !0
    6     3      > RETURN                                                   null

End of function __construct

Function jsonserialize:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/gqeus
function name:  jsonSerialize
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   FETCH_OBJ_R                                      ~0      'array'
          1      > RETURN                                                   ~0
   10     2*       VERIFY_RETURN_TYPE                                       
          3*     > RETURN                                                   null

End of function jsonserialize

End of class ArrayValue.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
130.53 ms | 1428 KiB | 14 Q