3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Animal { public function __call($name, $args) { if (preg_match('/^is(A-Z].+)/', $name, $matches)) { return 1; return $matches[1] === get_called_class(); } } } class Cat extends Animal { } class Dog extends Animal { } $dog = new Dog(); var_dump( $dog->isDog() ); var_dump( $dog->isCat() );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/H7HaF
function name:  (null)
number of ops:  14
compiled vars:  !0 = $dog
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   NEW                                              $1      'Dog'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   24     3        INIT_FCALL                                               'var_dump'
          4        INIT_METHOD_CALL                                         !0, 'isDog'
          5        DO_FCALL                                      0  $4      
          6        SEND_VAR                                                 $4
          7        DO_ICALL                                                 
   25     8        INIT_FCALL                                               'var_dump'
          9        INIT_METHOD_CALL                                         !0, 'isCat'
         10        DO_FCALL                                      0  $6      
         11        SEND_VAR                                                 $6
         12        DO_ICALL                                                 
         13      > RETURN                                                   1

Class Animal:
Function __call:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 13
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/H7HaF
function name:  __call
number of ops:  14
compiled vars:  !0 = $name, !1 = $args, !2 = $matches
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    7     2        INIT_FCALL                                               'preg_match'
          3        SEND_VAL                                                 '%2F%5Eis%28A-Z%5D.%2B%29%2F'
          4        SEND_VAR                                                 !0
          5        SEND_REF                                                 !2
          6        DO_ICALL                                         $3      
          7      > JMPZ                                                     $3, ->13
    8     8    > > RETURN                                                   1
    9     9*       FETCH_DIM_R                                      ~4      !2, 1
         10*       GET_CALLED_CLASS                                 ~5      
         11*       IS_IDENTICAL                                     ~6      ~4, ~5
         12*       RETURN                                                   ~6
   11    13    > > RETURN                                                   null

End of function __call

End of class Animal.

Class Cat:
Function __call:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 13
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/H7HaF
function name:  __call
number of ops:  14
compiled vars:  !0 = $name, !1 = $args, !2 = $matches
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    7     2        INIT_FCALL                                               'preg_match'
          3        SEND_VAL                                                 '%2F%5Eis%28A-Z%5D.%2B%29%2F'
          4        SEND_VAR                                                 !0
          5        SEND_REF                                                 !2
          6        DO_ICALL                                         $3      
          7      > JMPZ                                                     $3, ->13
    8     8    > > RETURN                                                   1
    9     9*       FETCH_DIM_R                                      ~4      !2, 1
         10*       GET_CALLED_CLASS                                 ~5      
         11*       IS_IDENTICAL                                     ~6      ~4, ~5
         12*       RETURN                                                   ~6
   11    13    > > RETURN                                                   null

End of function __call

End of class Cat.

Class Dog:
Function __call:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 13
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/H7HaF
function name:  __call
number of ops:  14
compiled vars:  !0 = $name, !1 = $args, !2 = $matches
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    7     2        INIT_FCALL                                               'preg_match'
          3        SEND_VAL                                                 '%2F%5Eis%28A-Z%5D.%2B%29%2F'
          4        SEND_VAR                                                 !0
          5        SEND_REF                                                 !2
          6        DO_ICALL                                         $3      
          7      > JMPZ                                                     $3, ->13
    8     8    > > RETURN                                                   1
    9     9*       FETCH_DIM_R                                      ~4      !2, 1
         10*       GET_CALLED_CLASS                                 ~5      
         11*       IS_IDENTICAL                                     ~6      ~4, ~5
         12*       RETURN                                                   ~6
   11    13    > > RETURN                                                   null

End of function __call

End of class Dog.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.68 ms | 1400 KiB | 17 Q