3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Test implements Countable { public $prop1; private $propa=2; protected $propx=3; public $prop4 = array(1,2,3,4); public function Greet() { return 'hello world'; } public function getCount() { $res = (array) $this; return count($res); } public function count() { return $this->getCount(); } } $t = new Test; echo $t->Greet(),"\n"; echo count( (array) $t),"\n"; echo $t->getCount(),"\n"; echo count($t),"\n"; var_dump( get_object_vars($t) ); $a = (array) $t; echo count(new ArrayObject($a)); // publlic props & all props public
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Da7ug
function name:  (null)
number of ops:  33
compiled vars:  !0 = $t, !1 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   DECLARE_CLASS                                            'test'
   22     1        NEW                                              $2      'Test'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $2
   23     4        INIT_METHOD_CALL                                         !0, 'Greet'
          5        DO_FCALL                                      0  $5      
          6        ECHO                                                     $5
          7        ECHO                                                     '%0A'
   24     8        CAST                                          7  ~6      !0
          9        COUNT                                            ~7      ~6
         10        ECHO                                                     ~7
         11        ECHO                                                     '%0A'
   25    12        INIT_METHOD_CALL                                         !0, 'getCount'
         13        DO_FCALL                                      0  $8      
         14        ECHO                                                     $8
         15        ECHO                                                     '%0A'
   26    16        COUNT                                            ~9      !0
         17        ECHO                                                     ~9
         18        ECHO                                                     '%0A'
   27    19        INIT_FCALL                                               'var_dump'
         20        INIT_FCALL                                               'get_object_vars'
         21        SEND_VAR                                                 !0
         22        DO_ICALL                                         $10     
         23        SEND_VAR                                                 $10
         24        DO_ICALL                                                 
   28    25        CAST                                          7  ~12     !0
         26        ASSIGN                                                   !1, ~12
   29    27        NEW                                              $14     'ArrayObject'
         28        SEND_VAR_EX                                              !1
         29        DO_FCALL                                      0          
         30        COUNT                                            ~16     $14
         31        ECHO                                                     ~16
         32      > RETURN                                                   1

Class Test:
Function greet:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Da7ug
function name:  Greet
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E > > RETURN                                                   'hello+world'
   11     1*     > RETURN                                                   null

End of function greet

Function getcount:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Da7ug
function name:  getCount
number of ops:  6
compiled vars:  !0 = $res
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   FETCH_THIS                                       ~1      
          1        CAST                                          7  ~2      ~1
          2        ASSIGN                                                   !0, ~2
   15     3        COUNT                                            ~4      !0
          4      > RETURN                                                   ~4
   16     5*     > RETURN                                                   null

End of function getcount

Function count:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Da7ug
function name:  count
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   INIT_METHOD_CALL                                         'getCount'
          1        DO_FCALL                                      0  $0      
          2      > RETURN                                                   $0
   20     3*     > RETURN                                                   null

End of function count

End of class Test.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.99 ms | 1400 KiB | 17 Q