3v4l.org

run code in 500+ PHP versions simultaneously
<?php trait PersonPL{ public function sayHello($name){ echo 'Witaj, nazywam siÄ™ '.$name; } public function whereFrom($country){ echo 'Jestem z '.$country; } } trait PersonENG{ public function sayHello($name){ echo 'Hi, my name is '.$name; } public function whereFrom($country){ echo 'I am form '.$country; } } class TestA{ use PersonPL, PersonENG{ PersonPL::sayHello insteadof PersonENG; PersonPL::whereFrom insteadof PersonENG; PersonENG::sayHello as sayHelloENG; PersonENG::whereFrom as whereFromENG; } } $objectA = new TestA(); $objectA->sayHello("Anna"); $objectA->whereFrom("Polski"); $objectA->sayHelloENG("Anna"); $objectA->whereFromENG("Poland");
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CfmLM
function name:  (null)
number of ops:  17
compiled vars:  !0 = $objectA
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   22     0  E >   DECLARE_CLASS                                                'testa'
   31     1        NEW                                                  $1      'TestA'
          2        DO_FCALL                                          0          
          3        ASSIGN                                                       !0, $1
   32     4        INIT_METHOD_CALL                                             !0, 'sayHello'
          5        SEND_VAL_EX                                                  'Anna'
          6        DO_FCALL                                          0          
   33     7        INIT_METHOD_CALL                                             !0, 'whereFrom'
          8        SEND_VAL_EX                                                  'Polski'
          9        DO_FCALL                                          0          
   34    10        INIT_METHOD_CALL                                             !0, 'sayHelloENG'
         11        SEND_VAL_EX                                                  'Anna'
         12        DO_FCALL                                          0          
   35    13        INIT_METHOD_CALL                                             !0, 'whereFromENG'
         14        SEND_VAL_EX                                                  'Poland'
         15        DO_FCALL                                          0          
         16      > RETURN                                                       1

Class PersonPL:
Function sayhello:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CfmLM
function name:  sayHello
number of ops:  4
compiled vars:  !0 = $name
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   RECV                                                 !0      
    4     1        CONCAT                                               ~1      'Witaj%2C+nazywam+si%C4%99+', !0
          2        ECHO                                                         ~1
    5     3      > RETURN                                                       null

End of function sayhello

Function wherefrom:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CfmLM
function name:  whereFrom
number of ops:  4
compiled vars:  !0 = $country
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    7     0  E >   RECV                                                 !0      
    8     1        CONCAT                                               ~1      'Jestem+z+', !0
          2        ECHO                                                         ~1
    9     3      > RETURN                                                       null

End of function wherefrom

End of class PersonPL.

Class PersonENG:
Function sayhello:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CfmLM
function name:  sayHello
number of ops:  4
compiled vars:  !0 = $name
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   13     0  E >   RECV                                                 !0      
   14     1        CONCAT                                               ~1      'Hi%2C+my+name+is+', !0
          2        ECHO                                                         ~1
   15     3      > RETURN                                                       null

End of function sayhello

Function wherefrom:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CfmLM
function name:  whereFrom
number of ops:  4
compiled vars:  !0 = $country
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   17     0  E >   RECV                                                 !0      
   18     1        CONCAT                                               ~1      'I+am+form+', !0
          2        ECHO                                                         ~1
   19     3      > RETURN                                                       null

End of function wherefrom

End of class PersonENG.

Class TestA: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
152.67 ms | 2137 KiB | 13 Q