3v4l.org

run code in 300+ PHP versions simultaneously
<?php declare(strict_types=1); namespace Domain\Mixins { trait ContentAware { protected string $content; public function getContent() { return $this->content; } public function setContent(string $content) { $this->content = $content; } } use Domain\user\User; trait UserAware { protected User $author; public function getAuthor() { return $this->author; } public function setAuthor(User $author) { $this->author = $author; } } } namespace Domain\User { class User { public function __construct(public string $name){} } } namespace Domain\Forum { use Domain\Mixins; class Message { use Mixins\ContentAware, Mixins\UserAware; } } namespace { use Domain\Forum\Message; use Domain\User\User; $message = new Message; $message->setContent('Hello'); $message->setAuthor(new User('greg')); echo sprintf('%s %s', $message->getContent(), $message->getAuthor()->name); }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/frW8k
function name:  (null)
number of ops:  25
compiled vars:  !0 = $message
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   42     0  E >   DECLARE_CLASS                                            'domain%5Cforum%5Cmessage'
   51     1        NEW                                              $1      'Domain%5CForum%5CMessage'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $1
   52     4        INIT_METHOD_CALL                                         !0, 'setContent'
          5        SEND_VAL_EX                                              'Hello'
          6        DO_FCALL                                      0          
   53     7        INIT_METHOD_CALL                                         !0, 'setAuthor'
          8        NEW                                              $5      'Domain%5CUser%5CUser'
          9        SEND_VAL_EX                                              'greg'
         10        DO_FCALL                                      0          
         11        SEND_VAR_NO_REF_EX                                       $5
         12        DO_FCALL                                      0          
   55    13        INIT_FCALL                                               'sprintf'
         14        SEND_VAL                                                 '%25s+%25s'
         15        INIT_METHOD_CALL                                         !0, 'getContent'
         16        DO_FCALL                                      0  $8      
         17        SEND_VAR                                                 $8
         18        INIT_METHOD_CALL                                         !0, 'getAuthor'
         19        DO_FCALL                                      0  $9      
         20        FETCH_OBJ_R                                      ~10     $9, 'name'
         21        SEND_VAL                                                 ~10
         22        DO_ICALL                                         $11     
         23        ECHO                                                     $11
   57    24      > RETURN                                                   1

Class Domain\Mixins\ContentAware:
Function getcontent:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/frW8k
function name:  getContent
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   FETCH_OBJ_R                                      ~0      'content'
          1      > RETURN                                                   ~0
   11     2*     > RETURN                                                   null

End of function getcontent

Function setcontent:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/frW8k
function name:  setContent
number of ops:  4
compiled vars:  !0 = $content
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   RECV                                             !0      
   14     1        ASSIGN_OBJ                                               'content'
          2        OP_DATA                                                  !0
   15     3      > RETURN                                                   null

End of function setcontent

End of class Domain\Mixins\ContentAware.

Class Domain\Mixins\UserAware:
Function getauthor:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/frW8k
function name:  getAuthor
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   24     0  E >   FETCH_OBJ_R                                      ~0      'author'
          1      > RETURN                                                   ~0
   25     2*     > RETURN                                                   null

End of function getauthor

Function setauthor:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/frW8k
function name:  setAuthor
number of ops:  4
compiled vars:  !0 = $author
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   27     0  E >   RECV                                             !0      
   28     1        ASSIGN_OBJ                                               'author'
          2        OP_DATA                                                  !0
   29     3      > RETURN                                                   null

End of function setauthor

End of class Domain\Mixins\UserAware.

Class Domain\User\User:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/frW8k
function name:  __construct
number of ops:  4
compiled vars:  !0 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   35     0  E >   RECV                                             !0      
          1        ASSIGN_OBJ                                               'name'
          2        OP_DATA                                                  !0
          3      > RETURN                                                   null

End of function __construct

End of class Domain\User\User.

Class Domain\Forum\Message: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
160.32 ms | 1400 KiB | 15 Q