3v4l.org

run code in 300+ PHP versions simultaneously
<?php error_reporting(-1); class C implements Countable { function count() { return 1; } } $c = new C; echo '<pre>'; echo 'standard: ', count($c), "\n"; echo '"recursive": ', count(array($c), COUNT_RECURSIVE), "\n"; echo '"recursive": ', count(array(new stdClass()), COUNT_RECURSIVE), "\n"; echo '</pre>';
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/s9aDg
function name:  (null)
number of ops:  32
compiled vars:  !0 = $c
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'error_reporting'
          1        SEND_VAL                                                 -1
          2        DO_ICALL                                                 
    5     3        DECLARE_CLASS                                            'c'
    7     4        NEW                                              $2      'C'
          5        DO_FCALL                                      0          
          6        ASSIGN                                                   !0, $2
    9     7        ECHO                                                     '%3Cpre%3E'
   10     8        ECHO                                                     'standard%3A+'
          9        COUNT                                            ~5      !0
         10        ECHO                                                     ~5
         11        ECHO                                                     '%0A'
   12    12        ECHO                                                     '%22recursive%22%3A+'
         13        INIT_FCALL                                               'count'
         14        INIT_ARRAY                                       ~6      !0
         15        SEND_VAL                                                 ~6
         16        SEND_VAL                                                 1
         17        DO_ICALL                                         $7      
         18        ECHO                                                     $7
         19        ECHO                                                     '%0A'
   13    20        ECHO                                                     '%22recursive%22%3A+'
         21        INIT_FCALL                                               'count'
         22        NEW                                              $8      'stdClass'
         23        DO_FCALL                                      0          
         24        INIT_ARRAY                                       ~10     $8
         25        SEND_VAL                                                 ~10
         26        SEND_VAL                                                 1
         27        DO_ICALL                                         $11     
         28        ECHO                                                     $11
         29        ECHO                                                     '%0A'
   14    30        ECHO                                                     '%3C%2Fpre%3E'
         31      > RETURN                                                   1

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

End of function count

End of class C.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.19 ms | 1396 KiB | 17 Q