3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace Foo; class Request { private array $attributes = []; public function __get(string $key): mixed { return $this->$attributes[$key]; } public function __set(string $key, mixed $value): void { $this->attributes[$key] = $value; } public function only(array $keys): array { return array_intersect_key($this->attributes, array_flip($keys)); } } $request = new Request(); $request->name = 'Foo'; $request->objectives = 'Test'; $request->requirements = 'Test'; // ... var_dump($request->only(['name', 'objectives']));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/DXflD
function name:  (null)
number of ops:  16
compiled vars:  !0 = $request
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   25     0  E >   NEW                                              $1      'Foo%5CRequest'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   26     3        ASSIGN_OBJ                                               !0, 'name'
          4        OP_DATA                                                  'Foo'
   27     5        ASSIGN_OBJ                                               !0, 'objectives'
          6        OP_DATA                                                  'Test'
   28     7        ASSIGN_OBJ                                               !0, 'requirements'
          8        OP_DATA                                                  'Test'
   31     9        INIT_NS_FCALL_BY_NAME                                    'Foo%5Cvar_dump'
         10        INIT_METHOD_CALL                                         !0, 'only'
         11        SEND_VAL_EX                                              <array>
         12        DO_FCALL                                      0  $7      
         13        SEND_VAR_NO_REF_EX                                       $7
         14        DO_FCALL                                      0          
         15      > RETURN                                                   1

Class Foo\Request:
Function __get:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/DXflD
function name:  __get
number of ops:  6
compiled vars:  !0 = $key, !1 = $attributes
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
   11     1        FETCH_OBJ_R                                      ~2      !1
          2        FETCH_DIM_R                                      ~3      ~2, !0
          3      > RETURN                                                   ~3
   12     4*       VERIFY_RETURN_TYPE                                       
          5*     > RETURN                                                   null

End of function __get

Function __set:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/DXflD
function name:  __set
number of ops:  6
compiled vars:  !0 = $key, !1 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   16     2        FETCH_OBJ_W                                      $2      'attributes'
          3        ASSIGN_DIM                                               $2, !0
          4        OP_DATA                                                  !1
   17     5      > RETURN                                                   null

End of function __set

Function only:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/DXflD
function name:  only
number of ops:  14
compiled vars:  !0 = $keys
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   RECV                                             !0      
   21     1        INIT_NS_FCALL_BY_NAME                                    'Foo%5Carray_intersect_key'
          2        CHECK_FUNC_ARG                                           
          3        FETCH_OBJ_FUNC_ARG                               $1      'attributes'
          4        SEND_FUNC_ARG                                            $1
          5        INIT_NS_FCALL_BY_NAME                                    'Foo%5Carray_flip'
          6        SEND_VAR_EX                                              !0
          7        DO_FCALL                                      0  $2      
          8        SEND_VAR_NO_REF_EX                                       $2
          9        DO_FCALL                                      0  $3      
         10        VERIFY_RETURN_TYPE                                       $3
         11      > RETURN                                                   $3
   22    12*       VERIFY_RETURN_TYPE                                       
         13*     > RETURN                                                   null

End of function only

End of class Foo\Request.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
145.53 ms | 1012 KiB | 16 Q