3v4l.org

run code in 300+ PHP versions simultaneously
<?php class TestCounter { private $private = 1; protected $protected = 2; public $public1 = 3; public $public2 = 4; public function countSelf() { return count($this); } } $test = new TestCounter; var_dump(count($test), $test->countSelf()); $test->prop1 = 3; var_dump(count($test), $test->countSelf()); $test->prop2 = 4; var_dump(count($test), $test->countSelf());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/FNh3u
function name:  (null)
number of ops:  29
compiled vars:  !0 = $test
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   NEW                                              $1      'TestCounter'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   15     3        INIT_FCALL                                               'var_dump'
          4        COUNT                                            ~4      !0
          5        SEND_VAL                                                 ~4
          6        INIT_METHOD_CALL                                         !0, 'countSelf'
          7        DO_FCALL                                      0  $5      
          8        SEND_VAR                                                 $5
          9        DO_ICALL                                                 
   17    10        ASSIGN_OBJ                                               !0, 'prop1'
         11        OP_DATA                                                  3
   18    12        INIT_FCALL                                               'var_dump'
         13        COUNT                                            ~8      !0
         14        SEND_VAL                                                 ~8
         15        INIT_METHOD_CALL                                         !0, 'countSelf'
         16        DO_FCALL                                      0  $9      
         17        SEND_VAR                                                 $9
         18        DO_ICALL                                                 
   20    19        ASSIGN_OBJ                                               !0, 'prop2'
         20        OP_DATA                                                  4
   21    21        INIT_FCALL                                               'var_dump'
         22        COUNT                                            ~12     !0
         23        SEND_VAL                                                 ~12
         24        INIT_METHOD_CALL                                         !0, 'countSelf'
         25        DO_FCALL                                      0  $13     
         26        SEND_VAR                                                 $13
         27        DO_ICALL                                                 
         28      > RETURN                                                   1

Class TestCounter:
Function countself:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/FNh3u
function name:  countSelf
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   FETCH_THIS                                       ~0      
          1        COUNT                                            ~1      ~0
          2      > RETURN                                                   ~1
   11     3*     > RETURN                                                   null

End of function countself

End of class TestCounter.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.11 ms | 1401 KiB | 15 Q