3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Test implements Countable { public $prop1; private $propa; protected $propx; 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"; echo count( get_object_vars($t) );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/NVR00
function name:  (null)
number of ops:  25
compiled vars:  !0 = $t
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   DECLARE_CLASS                                            'test'
   21     1        NEW                                              $1      'Test'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $1
   22     4        INIT_METHOD_CALL                                         !0, 'Greet'
          5        DO_FCALL                                      0  $4      
          6        ECHO                                                     $4
          7        ECHO                                                     '%0A'
   23     8        CAST                                          7  ~5      !0
          9        COUNT                                            ~6      ~5
         10        ECHO                                                     ~6
         11        ECHO                                                     '%0A'
   24    12        INIT_METHOD_CALL                                         !0, 'getCount'
         13        DO_FCALL                                      0  $7      
         14        ECHO                                                     $7
         15        ECHO                                                     '%0A'
   25    16        COUNT                                            ~8      !0
         17        ECHO                                                     ~8
         18        ECHO                                                     '%0A'
   26    19        INIT_FCALL                                               'get_object_vars'
         20        SEND_VAR                                                 !0
         21        DO_ICALL                                         $9      
         22        COUNT                                            ~10     $9
         23        ECHO                                                     ~10
         24      > RETURN                                                   1

Class Test:
Function greet:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/NVR00
function name:  Greet
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E > > RETURN                                                   'hello+world'
   10     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/NVR00
function name:  getCount
number of ops:  6
compiled vars:  !0 = $res
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   FETCH_THIS                                       ~1      
          1        CAST                                          7  ~2      ~1
          2        ASSIGN                                                   !0, ~2
   14     3        COUNT                                            ~4      !0
          4      > RETURN                                                   ~4
   15     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/NVR00
function name:  count
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   INIT_METHOD_CALL                                         'getCount'
          1        DO_FCALL                                      0  $0      
          2      > RETURN                                                   $0
   19     3*     > RETURN                                                   null

End of function count

End of class Test.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
145.86 ms | 1400 KiB | 15 Q