3v4l.org

run code in 300+ PHP versions simultaneously
<?php class CountMe implements Countable { private $_count; public function __construct($fixedCount) { $this->_count = $fixedCount; } public function count() { return $this->_count; } } $fourtytwo = new CountMe(42); $zero = new CountMe(0); var_dump( count($fourtytwo), count($fourtytwo)==0, empty($fourtytwo), $fourtytwo == array(), $fourtytwo === array() ); print str_repeat('-', 42)."\n"; var_dump( count($zero), count($zero)==0, empty($zero), $zero == array(), $zero === array() );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/JqcaY
function name:  (null)
number of ops:  42
compiled vars:  !0 = $fourtytwo, !1 = $zero
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   DECLARE_CLASS                                            'countme'
   18     1        NEW                                              $2      'CountMe'
          2        SEND_VAL_EX                                              42
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !0, $2
   19     5        NEW                                              $5      'CountMe'
          6        SEND_VAL_EX                                              0
          7        DO_FCALL                                      0          
          8        ASSIGN                                                   !1, $5
   21     9        INIT_FCALL                                               'var_dump'
   22    10        COUNT                                            ~8      !0
         11        SEND_VAL                                                 ~8
   23    12        COUNT                                            ~9      !0
         13        IS_EQUAL                                         ~10     ~9, 0
         14        SEND_VAL                                                 ~10
   24    15        ISSET_ISEMPTY_CV                                 ~11     !0
         16        SEND_VAL                                                 ~11
   25    17        IS_EQUAL                                         ~12     !0, <array>
         18        SEND_VAL                                                 ~12
   26    19        IS_IDENTICAL                                     ~13     !0, <array>
         20        SEND_VAL                                                 ~13
   21    21        DO_ICALL                                                 
   29    22        INIT_FCALL                                               'str_repeat'
         23        SEND_VAL                                                 '-'
         24        SEND_VAL                                                 42
         25        DO_ICALL                                         $15     
         26        CONCAT                                           ~16     $15, '%0A'
         27        ECHO                                                     ~16
   31    28        INIT_FCALL                                               'var_dump'
   32    29        COUNT                                            ~17     !1
         30        SEND_VAL                                                 ~17
   33    31        COUNT                                            ~18     !1
         32        IS_EQUAL                                         ~19     ~18, 0
         33        SEND_VAL                                                 ~19
   34    34        ISSET_ISEMPTY_CV                                 ~20     !1
         35        SEND_VAL                                                 ~20
   35    36        IS_EQUAL                                         ~21     !1, <array>
         37        SEND_VAL                                                 ~21
   36    38        IS_IDENTICAL                                     ~22     !1, <array>
         39        SEND_VAL                                                 ~22
   31    40        DO_ICALL                                                 
   37    41      > RETURN                                                   1

Class CountMe:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/JqcaY
function name:  __construct
number of ops:  4
compiled vars:  !0 = $fixedCount
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
    9     1        ASSIGN_OBJ                                               '_count'
          2        OP_DATA                                                  !0
   10     3      > RETURN                                                   null

End of function __construct

Function count:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/JqcaY
function name:  count
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   FETCH_OBJ_R                                      ~0      '_count'
          1      > RETURN                                                   ~0
   15     2*     > RETURN                                                   null

End of function count

End of class CountMe.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
138.41 ms | 1006 KiB | 15 Q