3v4l.org

run code in 300+ PHP versions simultaneously
<?php function instantiable($className) { if (! $className) { return true; } $reflection = new ReflectionClass($className); $hasFinalConstruct = false; if ($reflection->hasMethod('__construct')) { $hasFinalConstruct = $reflection->getMethod('__construct')->isFinal(); } $parentClass = $reflection->getParentClass(); return instantiable($parentClass ? $parentClass->getName() : null) && ! ($reflection->isInternal() && $hasFinalConstruct); }; function not($function) { return function (...$args) use ($function) { return ! $function(...$args); }; }; var_dump([ 'instantiable' => array_filter(get_declared_classes(), 'instantiable'), 'not_instantiable' => array_filter(get_declared_classes(), not('instantiable')), ]);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/lqWDM
function name:  (null)
number of ops:  21
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   27     0  E >   INIT_FCALL                                               'var_dump'
   28     1        INIT_FCALL                                               'array_filter'
          2        INIT_FCALL                                               'get_declared_classes'
          3        DO_ICALL                                         $0      
          4        SEND_VAR                                                 $0
          5        SEND_VAL                                                 'instantiable'
          6        DO_ICALL                                         $1      
          7        INIT_ARRAY                                       ~2      $1, 'instantiable'
   29     8        INIT_FCALL                                               'array_filter'
          9        INIT_FCALL                                               'get_declared_classes'
         10        DO_ICALL                                         $3      
         11        SEND_VAR                                                 $3
         12        INIT_FCALL                                               'not'
         13        SEND_VAL                                                 'instantiable'
         14        DO_FCALL                                      0  $4      
         15        SEND_VAR                                                 $4
         16        DO_ICALL                                         $5      
         17        ADD_ARRAY_ELEMENT                                ~2      $5, 'not_instantiable'
         18        SEND_VAL                                                 ~2
         19        DO_ICALL                                                 
   30    20      > RETURN                                                   1

Function instantiable:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 4
Branch analysis from position: 3
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 13, Position 2 = 19
Branch analysis from position: 13
2 jumps found. (Code = 43) Position 1 = 24, Position 2 = 28
Branch analysis from position: 24
1 jumps found. (Code = 42) Position 1 = 29
Branch analysis from position: 29
2 jumps found. (Code = 46) Position 1 = 32, Position 2 = 38
Branch analysis from position: 32
2 jumps found. (Code = 46) Position 1 = 35, Position 2 = 36
Branch analysis from position: 35
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 36
Branch analysis from position: 38
Branch analysis from position: 28
2 jumps found. (Code = 46) Position 1 = 32, Position 2 = 38
Branch analysis from position: 32
Branch analysis from position: 38
Branch analysis from position: 19
filename:       /in/lqWDM
function name:  instantiable
number of ops:  40
compiled vars:  !0 = $className, !1 = $reflection, !2 = $hasFinalConstruct, !3 = $parentClass
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        BOOL_NOT                                         ~4      !0
          2      > JMPZ                                                     ~4, ->4
    5     3    > > RETURN                                                   <true>
    8     4    >   NEW                                              $5      'ReflectionClass'
          5        SEND_VAR_EX                                              !0
          6        DO_FCALL                                      0          
          7        ASSIGN                                                   !1, $5
    9     8        ASSIGN                                                   !2, <false>
   11     9        INIT_METHOD_CALL                                         !1, 'hasMethod'
         10        SEND_VAL_EX                                              '__construct'
         11        DO_FCALL                                      0  $9      
         12      > JMPZ                                                     $9, ->19
   12    13    >   INIT_METHOD_CALL                                         !1, 'getMethod'
         14        SEND_VAL_EX                                              '__construct'
         15        DO_FCALL                                      0  $10     
         16        INIT_METHOD_CALL                                         $10, 'isFinal'
         17        DO_FCALL                                      0  $11     
         18        ASSIGN                                                   !2, $11
   15    19    >   INIT_METHOD_CALL                                         !1, 'getParentClass'
         20        DO_FCALL                                      0  $13     
         21        ASSIGN                                                   !3, $13
   17    22        INIT_FCALL_BY_NAME                                       'instantiable'
         23      > JMPZ                                                     !3, ->28
         24    >   INIT_METHOD_CALL                                         !3, 'getName'
         25        DO_FCALL                                      0  $15     
         26        QM_ASSIGN                                        ~16     $15
         27      > JMP                                                      ->29
         28    >   QM_ASSIGN                                        ~16     null
         29    >   SEND_VAL_EX                                              ~16
         30        DO_FCALL                                      0  $17     
         31      > JMPZ_EX                                          ~18     $17, ->38
   18    32    >   INIT_METHOD_CALL                                         !1, 'isInternal'
         33        DO_FCALL                                      0  $19     
         34      > JMPZ_EX                                          ~20     $19, ->36
         35    >   BOOL                                             ~20     !2
         36    >   BOOL_NOT                                         ~21     ~20
         37        BOOL                                             ~18     ~21
         38    > > RETURN                                                   ~18
   19    39*     > RETURN                                                   null

End of function instantiable

Function not:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/lqWDM
function name:  not
number of ops:  5
compiled vars:  !0 = $function
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   RECV                                             !0      
   22     1        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FlqWDM%3A22%240'
          2        BIND_LEXICAL                                             ~1, !0
   24     3      > RETURN                                                   ~1
   25     4*     > RETURN                                                   null

End of function not

Function %00%7Bclosure%7D%2Fin%2FlqWDM%3A22%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/lqWDM
function name:  {closure}
number of ops:  9
compiled vars:  !0 = $args, !1 = $function
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   RECV_VARIADIC                                    !0      
          1        BIND_STATIC                                              !1
   23     2        INIT_DYNAMIC_CALL                                        !1
          3        SEND_UNPACK                                              !0
          4        CHECK_UNDEF_ARGS                                         
          5        DO_FCALL                                      1  $2      
          6        BOOL_NOT                                         ~3      $2
          7      > RETURN                                                   ~3
   24     8*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FlqWDM%3A22%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
165.12 ms | 1407 KiB | 20 Q