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(); printf("Brian %s a dog.\n", $brian->isDog() ? "is" : "is not"); printf("Brian %s a cat.\n", $brian->isCat() ? "is" : "is not");
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 10
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
2 jumps found. (Code = 43) Position 1 = 18, Position 2 = 20
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 21
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
2 jumps found. (Code = 43) Position 1 = 18, Position 2 = 20
Branch analysis from position: 18
Branch analysis from position: 20
filename:       /in/vd0sh
function name:  (null)
number of ops:  24
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                                               'printf'
          4        SEND_VAL                                                 'Brian+%25s+a+dog.%0A'
          5        INIT_METHOD_CALL                                         !0, 'isDog'
          6        DO_FCALL                                      0  $4      
          7      > JMPZ                                                     $4, ->10
          8    >   QM_ASSIGN                                        ~5      'is'
          9      > JMP                                                      ->11
         10    >   QM_ASSIGN                                        ~5      'is+not'
         11    >   SEND_VAL                                                 ~5
         12        DO_ICALL                                                 
   24    13        INIT_FCALL                                               'printf'
         14        SEND_VAL                                                 'Brian+%25s+a+cat.%0A'
         15        INIT_METHOD_CALL                                         !0, 'isCat'
         16        DO_FCALL                                      0  $7      
         17      > JMPZ                                                     $7, ->20
         18    >   QM_ASSIGN                                        ~8      'is'
         19      > JMP                                                      ->21
         20    >   QM_ASSIGN                                        ~8      'is+not'
         21    >   SEND_VAL                                                 ~8
         22        DO_ICALL                                                 
         23      > 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/vd0sh
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/vd0sh
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/vd0sh
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:
160.63 ms | 1400 KiB | 17 Q