3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo implements JsonSerializable { private $een; private $twee; public function __construct(string $een, int $twee = null) { $this->een = $een; $this->twee = $twee; } public function getEen(): string { return $this->een; } public function getTwee(): int { return $this->twee; } public function jsonSerialize(): array { return [$this->een, $this->twee]; } } $first = new Foo('thestring'); $storage = json_encode($first); var_dump($storage); $second = new Foo(...json_decode($storage, true)); var_dump($second);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/I6mRD
function name:  (null)
number of ops:  25
compiled vars:  !0 = $first, !1 = $storage, !2 = $second
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   DECLARE_CLASS                                            'foo'
   31     1        NEW                                              $3      'Foo'
          2        SEND_VAL_EX                                              'thestring'
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !0, $3
   33     5        INIT_FCALL                                               'json_encode'
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                         $6      
          8        ASSIGN                                                   !1, $6
   35     9        INIT_FCALL                                               'var_dump'
         10        SEND_VAR                                                 !1
         11        DO_ICALL                                                 
   37    12        NEW                                              $9      'Foo'
         13        INIT_FCALL                                               'json_decode'
         14        SEND_VAR                                                 !1
         15        SEND_VAL                                                 <true>
         16        DO_ICALL                                         $10     
         17        SEND_UNPACK                                              $10
         18        CHECK_UNDEF_ARGS                                         
         19        DO_FCALL                                      1          
         20        ASSIGN                                                   !2, $9
   39    21        INIT_FCALL                                               'var_dump'
         22        SEND_VAR                                                 !2
         23        DO_ICALL                                                 
         24      > RETURN                                                   1

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

End of function __construct

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

End of function geteen

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

End of function gettwee

Function jsonserialize:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/I6mRD
function name:  jsonSerialize
number of ops:  8
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   27     0  E >   FETCH_OBJ_R                                      ~0      'een'
          1        INIT_ARRAY                                       ~1      ~0
          2        FETCH_OBJ_R                                      ~2      'twee'
          3        ADD_ARRAY_ELEMENT                                ~1      ~2
          4        VERIFY_RETURN_TYPE                                       ~1
          5      > RETURN                                                   ~1
   28     6*       VERIFY_RETURN_TYPE                                       
          7*     > RETURN                                                   null

End of function jsonserialize

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
131.95 ms | 1405 KiB | 19 Q