3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Test implements Countable { public $prop1, $prop2,$prop3,$prop4=4; private $propa, $propb,$propc,$propd=44; protected $propx, $propy,$propz,$propzz=444; 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( array_keys(get_object_vars($t)));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/KTm3H
function name:  (null)
number of ops:  28
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                                               'array_keys'
         20        INIT_FCALL                                               'get_object_vars'
         21        SEND_VAR                                                 !0
         22        DO_ICALL                                         $9      
         23        SEND_VAR                                                 $9
         24        DO_ICALL                                         $10     
         25        COUNT                                            ~11     $10
         26        ECHO                                                     ~11
         27      > RETURN                                                   1

Class Test:
Function greet:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/KTm3H
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/KTm3H
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/KTm3H
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:
150.66 ms | 1392 KiB | 17 Q