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 $matches[1] === get_called_class(); } } } class Cat extends Animal { } class Dog extends Animal { } $brian = new Dog(); var_dump( $brian->isDog() ); var_dump( $brian->isCat() );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/UtXj3
function name:  (null)
number of ops:  14
compiled vars:  !0 = $brian
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   NEW                                              $1      'Dog'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   23     3        INIT_FCALL                                               'var_dump'
          4        INIT_METHOD_CALL                                         !0, 'isDog'
          5        DO_FCALL                                      0  $4      
          6        SEND_VAR                                                 $4
          7        DO_ICALL                                                 
   24     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 = 12
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/UtXj3
function name:  __call
number of ops:  13
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%28%5BA-Z%5D.%2B%29%2F'
          4        SEND_VAR                                                 !0
          5        SEND_REF                                                 !2
          6        DO_ICALL                                         $3      
          7      > JMPZ                                                     $3, ->12
    8     8    >   FETCH_DIM_R                                      ~4      !2, 1
          9        GET_CALLED_CLASS                                 ~5      
         10        IS_IDENTICAL                                     ~6      ~4, ~5
         11      > RETURN                                                   ~6
   10    12    > > 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 = 12
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/UtXj3
function name:  __call
number of ops:  13
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%28%5BA-Z%5D.%2B%29%2F'
          4        SEND_VAR                                                 !0
          5        SEND_REF                                                 !2
          6        DO_ICALL                                         $3      
          7      > JMPZ                                                     $3, ->12
    8     8    >   FETCH_DIM_R                                      ~4      !2, 1
          9        GET_CALLED_CLASS                                 ~5      
         10        IS_IDENTICAL                                     ~6      ~4, ~5
         11      > RETURN                                                   ~6
   10    12    > > 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 = 12
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/UtXj3
function name:  __call
number of ops:  13
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%28%5BA-Z%5D.%2B%29%2F'
          4        SEND_VAR                                                 !0
          5        SEND_REF                                                 !2
          6        DO_ICALL                                         $3      
          7      > JMPZ                                                     $3, ->12
    8     8    >   FETCH_DIM_R                                      ~4      !2, 1
          9        GET_CALLED_CLASS                                 ~5      
         10        IS_IDENTICAL                                     ~6      ~4, ~5
         11      > RETURN                                                   ~6
   10    12    > > RETURN                                                   null

End of function __call

End of class Dog.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.97 ms | 1400 KiB | 17 Q