3v4l.org

run code in 300+ PHP versions simultaneously
<?php class States { const STATUS_PASSED = 'ok'; const STATUS_FAILED = 'failed'; const DONT_USE = 'lolol'; public function reflect() { $x = new \ReflectionClass($this); $consts = $x->getConstants(); $statuses = array_filter($consts, function($value, $key) { return strpos($key, 'STATUS') !== false; }, ARRAY_FILTER_USE_BOTH); var_dump($statuses); } } $x = new States; $x->reflect();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/X9FdB
function name:  (null)
number of ops:  6
compiled vars:  !0 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   NEW                                              $1      'States'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   22     3        INIT_METHOD_CALL                                         !0, 'reflect'
          4        DO_FCALL                                      0          
          5      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FX9FdB%3A13%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/X9FdB
function name:  {closure}
number of ops:  9
compiled vars:  !0 = $value, !1 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   14     2        INIT_FCALL                                               'strpos'
          3        SEND_VAR                                                 !1
          4        SEND_VAL                                                 'STATUS'
          5        DO_ICALL                                         $2      
          6        TYPE_CHECK                                  1018  ~3      $2
          7      > RETURN                                                   ~3
   15     8*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FX9FdB%3A13%240

Class States:
Function reflect:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/X9FdB
function name:  reflect
number of ops:  19
compiled vars:  !0 = $x, !1 = $consts, !2 = $statuses
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   NEW                                              $3      'ReflectionClass'
          1        FETCH_THIS                                       $4      
          2        SEND_VAR_EX                                              $4
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !0, $3
   11     5        INIT_METHOD_CALL                                         !0, 'getConstants'
          6        DO_FCALL                                      0  $7      
          7        ASSIGN                                                   !1, $7
   13     8        INIT_FCALL                                               'array_filter'
          9        SEND_VAR                                                 !1
         10        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FX9FdB%3A13%240'
   15    11        SEND_VAL                                                 ~9
         12        SEND_VAL                                                 1
         13        DO_ICALL                                         $10     
   13    14        ASSIGN                                                   !2, $10
   17    15        INIT_FCALL                                               'var_dump'
         16        SEND_VAR                                                 !2
         17        DO_ICALL                                                 
   18    18      > RETURN                                                   null

End of function reflect

End of class States.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.92 ms | 1392 KiB | 19 Q