3v4l.org

run code in 300+ PHP versions simultaneously
<?php interface A { public function foo(string $s): string; public function bar(int $i): int; } // Абстрактный класс может реализовывать только часть интерфейса. // Классы, расширяющие абстрактный класс, должны реализовать все остальные. abstract class B implements A { public function foo(string $s): string { return $s . PHP_EOL; } } class C extends B { public function bar(int $i): int { return $i * 2; } } $c = new C(); echo $c->bar(2); // OK, 4 $b = new B(); $b->foo("123");
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/nSJIF
function name:  (null)
number of ops:  16
compiled vars:  !0 = $c, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   DECLARE_CLASS                                            'b'
   20     1        DECLARE_CLASS                                            'c', 'b'
   28     2        NEW                                              $2      'C'
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !0, $2
   29     5        INIT_METHOD_CALL                                         !0, 'bar'
          6        SEND_VAL_EX                                              2
          7        DO_FCALL                                      0  $5      
          8        ECHO                                                     $5
   31     9        NEW                                              $6      'B'
         10        DO_FCALL                                      0          
         11        ASSIGN                                                   !1, $6
   32    12        INIT_METHOD_CALL                                         !1, 'foo'
         13        SEND_VAL_EX                                              '123'
         14        DO_FCALL                                      0          
         15      > RETURN                                                   1

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

End of function foo

Function bar:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/nSJIF
function name:  bar
number of ops:  3
compiled vars:  !0 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
          1        VERIFY_RETURN_TYPE                                       
          2      > RETURN                                                   null

End of function bar

End of class A.

Class B:
Function foo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/nSJIF
function name:  foo
number of ops:  6
compiled vars:  !0 = $s
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   RECV                                             !0      
   16     1        CONCAT                                           ~1      !0, '%0A'
          2        VERIFY_RETURN_TYPE                                       ~1
          3      > RETURN                                                   ~1
   17     4*       VERIFY_RETURN_TYPE                                       
          5*     > RETURN                                                   null

End of function foo

End of class B.

Class C:
Function bar:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/nSJIF
function name:  bar
number of ops:  6
compiled vars:  !0 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   RECV                                             !0      
   24     1        MUL                                              ~1      !0, 2
          2        VERIFY_RETURN_TYPE                                       ~1
          3      > RETURN                                                   ~1
   25     4*       VERIFY_RETURN_TYPE                                       
          5*     > RETURN                                                   null

End of function bar

End of class C.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
12.63 ms | 467 KiB | 7 Q