3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Everything you enter here will be executed by our servers. Try it! class Example { public $publicSetting = 'public'; protected $protectedSetting = 'protected'; private $privateSetting = 'private'; public function showEverything() { return get_object_vars($this); } public function showMyPublicsOnly() { $analyse = function($object) { return get_object_vars($object); }; return $analyse($this); } } $example = new Example(); var_dump(get_object_vars($example)); var_dump($example->showEverything()); var_dump($example->showMyPublicsOnly());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/D0tPb
function name:  (null)
number of ops:  20
compiled vars:  !0 = $example
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   NEW                                              $1      'Example'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   24     3        INIT_FCALL                                               'var_dump'
          4        INIT_FCALL                                               'get_object_vars'
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                         $4      
          7        SEND_VAR                                                 $4
          8        DO_ICALL                                                 
   25     9        INIT_FCALL                                               'var_dump'
         10        INIT_METHOD_CALL                                         !0, 'showEverything'
         11        DO_FCALL                                      0  $6      
         12        SEND_VAR                                                 $6
         13        DO_ICALL                                                 
   26    14        INIT_FCALL                                               'var_dump'
         15        INIT_METHOD_CALL                                         !0, 'showMyPublicsOnly'
         16        DO_FCALL                                      0  $8      
         17        SEND_VAR                                                 $8
         18        DO_ICALL                                                 
         19      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FD0tPb%3A16%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/D0tPb
function name:  {closure}
number of ops:  6
compiled vars:  !0 = $object
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   RECV                                             !0      
   17     1        INIT_FCALL                                               'get_object_vars'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $1      
          4      > RETURN                                                   $1
   18     5*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FD0tPb%3A16%240

Class Example:
Function showeverything:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/D0tPb
function name:  showEverything
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   INIT_FCALL                                               'get_object_vars'
          1        FETCH_THIS                                       ~0      
          2        SEND_VAL                                                 ~0
          3        DO_ICALL                                         $1      
          4      > RETURN                                                   $1
   12     5*     > RETURN                                                   null

End of function showeverything

Function showmypublicsonly:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/D0tPb
function name:  showMyPublicsOnly
number of ops:  8
compiled vars:  !0 = $analyse
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FD0tPb%3A16%240'
          1        ASSIGN                                                   !0, ~1
   19     2        INIT_DYNAMIC_CALL                                        !0
          3        FETCH_THIS                                       $3      
          4        SEND_VAR_EX                                              $3
          5        DO_FCALL                                      0  $4      
          6      > RETURN                                                   $4
   20     7*     > RETURN                                                   null

End of function showmypublicsonly

End of class Example.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
158.37 ms | 1400 KiB | 17 Q