3v4l.org

run code in 500+ PHP versions simultaneously
<?php class Element { /** * Checks if the key is a property. * * @param string $key * The key to check. * * @return bool * TRUE of the key is a property, FALSE otherwise. */ public static function property($key) { return is_string($key) && $key[0] == '#'; } /** * Gets properties of a structured array element (keys beginning with '#'). * * @param array $element * An element array to return properties for. * * @return array * An array of property keys for the element. */ public static function properties(array $element) { return array_filter(array_keys($element), 'static::property'); } } $element = [ '#property1' => 'property1', '#property2' => 'property2', 'property3' => 'property3', 0 => [], ]; $properties = Element::properties($element); var_dump($properties);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fn61K
function name:  (null)
number of ops:  9
compiled vars:  !0 = $element, !1 = $properties
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   32     0  E >   ASSIGN                                                       !0, <array>
   39     1        INIT_STATIC_METHOD_CALL                                      'Element', 'properties'
          2        SEND_VAR                                                     !0
          3        DO_FCALL                                          0  $3      
          4        ASSIGN                                                       !1, $3
   41     5        INIT_FCALL                                                   'var_dump'
          6        SEND_VAR                                                     !1
          7        DO_ICALL                                                     
          8      > RETURN                                                       1

Class Element:
Function property:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 3, Position 2 = 6
Branch analysis from position: 3
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
filename:       /in/fn61K
function name:  property
number of ops:  8
compiled vars:  !0 = $key
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   14     0  E >   RECV                                                 !0      
   15     1        TYPE_CHECK                                       64  ~1      !0
          2      > JMPZ_EX                                              ~1      ~1, ->6
          3    >   FETCH_DIM_R                                          ~2      !0, 0
          4        IS_EQUAL                                             ~3      ~2, '%23'
          5        BOOL                                                 ~1      ~3
          6    > > RETURN                                                       ~1
   16     7*     > RETURN                                                       null

End of function property

Function properties:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fn61K
function name:  properties
number of ops:  10
compiled vars:  !0 = $element
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   27     0  E >   RECV                                                 !0      
   28     1        INIT_FCALL                                                   'array_filter'
          2        INIT_FCALL                                                   'array_keys'
          3        SEND_VAR                                                     !0
          4        DO_ICALL                                             $1      
          5        SEND_VAR                                                     $1
          6        SEND_VAL                                                     'static%3A%3Aproperty'
          7        DO_ICALL                                             $2      
          8      > RETURN                                                       $2
   29     9*     > RETURN                                                       null

End of function properties

End of class Element.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
174.18 ms | 3400 KiB | 16 Q