3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo implements JSONSerializable { public $barPublic = 1; protected $barProtected = 2; private $barPrivate = 3; public function jsonSerialize() { return array( 'barPublic' => $this->barPublic, 'barProtected' => $this->barProtected, 'barPrivate' => $this->barPrivate, ); } } $foo = new Foo(); var_dump(json_encode($foo));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/bSJWU
function name:  (null)
number of ops:  11
compiled vars:  !0 = $foo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   DECLARE_CLASS                                            'foo'
   15     1        NEW                                              $1      'Foo'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $1
   17     4        INIT_FCALL                                               'var_dump'
          5        INIT_FCALL                                               'json_encode'
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                         $4      
          8        SEND_VAR                                                 $4
          9        DO_ICALL                                                 
         10      > RETURN                                                   1

Class Foo:
Function jsonserialize:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/bSJWU
function name:  jsonSerialize
number of ops:  8
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   FETCH_OBJ_R                                      ~0      'barPublic'
          1        INIT_ARRAY                                       ~1      ~0, 'barPublic'
   10     2        FETCH_OBJ_R                                      ~2      'barProtected'
          3        ADD_ARRAY_ELEMENT                                ~1      ~2, 'barProtected'
   11     4        FETCH_OBJ_R                                      ~3      'barPrivate'
          5        ADD_ARRAY_ELEMENT                                ~1      ~3, 'barPrivate'
          6      > RETURN                                                   ~1
   13     7*     > RETURN                                                   null

End of function jsonserialize

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
166.67 ms | 1399 KiB | 17 Q