3v4l.org

run code in 300+ PHP versions simultaneously
<?php class MyClass { private $v; public function __construct( $v ) { $this->v = $v; } } $cb = static fn ( $o ) => $o instanceof MyClass; $objects = [ null, false, new MyClass( "foo" ), "bar", new MyClass( 123 ), ]; $result = array_filter( $objects, static fn ( $o ) => $o instanceof MyClass ); var_dump( $result );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/4dYWk
function name:  (null)
number of ops:  24
compiled vars:  !0 = $cb, !1 = $objects, !2 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   DECLARE_LAMBDA_FUNCTION                          ~3      [0]
          1        ASSIGN                                                   !0, ~3
   11     2        INIT_ARRAY                                       ~5      null
          3        ADD_ARRAY_ELEMENT                                ~5      <false>
   13     4        NEW                                              $6      'MyClass'
          5        SEND_VAL_EX                                              'foo'
          6        DO_FCALL                                      0          
          7        ADD_ARRAY_ELEMENT                                ~5      $6
   14     8        ADD_ARRAY_ELEMENT                                ~5      'bar'
   15     9        NEW                                              $8      'MyClass'
         10        SEND_VAL_EX                                              123
         11        DO_FCALL                                      0          
         12        ADD_ARRAY_ELEMENT                                ~5      $8
   10    13        ASSIGN                                                   !1, ~5
   18    14        INIT_FCALL                                               'array_filter'
         15        SEND_VAR                                                 !1
         16        DECLARE_LAMBDA_FUNCTION                          ~11     [1]
         17        SEND_VAL                                                 ~11
         18        DO_ICALL                                         $12     
         19        ASSIGN                                                   !2, $12
   19    20        INIT_FCALL                                               'var_dump'
         21        SEND_VAR                                                 !2
         22        DO_ICALL                                                 
         23      > RETURN                                                   1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/4dYWk
function name:  {closure}
number of ops:  4
compiled vars:  !0 = $o
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
          1        INSTANCEOF                                       ~1      !0, 'MyClass'
          2      > RETURN                                                   ~1
          3*     > RETURN                                                   null

End of Dynamic Function 0

Dynamic Function 1
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/4dYWk
function name:  {closure}
number of ops:  4
compiled vars:  !0 = $o
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   RECV                                             !0      
          1        INSTANCEOF                                       ~1      !0, 'MyClass'
          2      > RETURN                                                   ~1
          3*     > RETURN                                                   null

End of Dynamic Function 1

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

End of function __construct

End of class MyClass.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
141.58 ms | 1016 KiB | 15 Q