3v4l.org

run code in 300+ PHP versions simultaneously
<?php /* ############################################################################################### #############################classes.php####################################################### ############################################################################################## */ class EmailAddress { private $emailAddress; public function getEmailAddress() { return $this->emailAddress; } public function setEmailAddress($mail) { $this->emailAddress = $mail; } } class AddressDisplay { private $addressType; private $addressText; public function getAddressType() { return $this->addressType; } public function setAddressType($type) { $this->addressType = $type; } public function getAddressText() { return $this->addressText; } public function setAddressText($mail) { $this->addressText = $mail; } } class EmailAddressDisplayAdapter extends AddressDisplay { public function __construct($mail) { $this->setAddressType('Email'); $this->setAddressText($mail->getEmailAddress()); } } /* ############################################################################################### ############################index.php######################################################## ############################################################################################## */ echo "<ol>"; echo "<li><p>\$email = new EmailAddress()</p></li>"; $email = new EmailAddress(); echo "<li><p>\$email->setEmailAddress('trueline.chirag@gmail.com')</p></li>"; $email->setEmailAddress('trueline.chirag@gmail.com'); echo "<li><p>\$address = new EmailAddressDisplayAdapter(\$email)</p></li>"; $address = new EmailAddressDisplayAdapter($email); echo "<li><p>printing \$address->getAddressType()::</p></li>"; echo "<ul>"; echo "<li><p>".$address->getAddressType()."</p></li>"; echo "</ul>"; echo "<li><p>printing \$address->getAddressText()::</p></li>"; echo "<ul>"; echo "<li><p>".$address->getAddressText()."</p></li>"; echo "</ul>"; echo "</ol>";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MDa0M
function name:  (null)
number of ops:  32
compiled vars:  !0 = $email, !1 = $address
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   56     0  E >   ECHO                                                     '%3Col%3E'
   58     1        ECHO                                                     '%3Cli%3E%3Cp%3E%24email+%3D+new+EmailAddress%28%29%3C%2Fp%3E%3C%2Fli%3E'
   59     2        NEW                                              $2      'EmailAddress'
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !0, $2
   60     5        ECHO                                                     '%3Cli%3E%3Cp%3E%24email-%3EsetEmailAddress%28%27trueline.chirag%40gmail.com%27%29%3C%2Fp%3E%3C%2Fli%3E'
   61     6        INIT_METHOD_CALL                                         !0, 'setEmailAddress'
          7        SEND_VAL_EX                                              'trueline.chirag%40gmail.com'
          8        DO_FCALL                                      0          
   62     9        ECHO                                                     '%3Cli%3E%3Cp%3E%24address+%3D+new+EmailAddressDisplayAdapter%28%24email%29%3C%2Fp%3E%3C%2Fli%3E'
   63    10        NEW                                              $6      'EmailAddressDisplayAdapter'
         11        SEND_VAR_EX                                              !0
         12        DO_FCALL                                      0          
         13        ASSIGN                                                   !1, $6
   64    14        ECHO                                                     '%3Cli%3E%3Cp%3Eprinting+%24address-%3EgetAddressType%28%29%3A%3A%3C%2Fp%3E%3C%2Fli%3E'
   65    15        ECHO                                                     '%3Cul%3E'
   66    16        INIT_METHOD_CALL                                         !1, 'getAddressType'
         17        DO_FCALL                                      0  $9      
         18        CONCAT                                           ~10     '%3Cli%3E%3Cp%3E', $9
         19        CONCAT                                           ~11     ~10, '%3C%2Fp%3E%3C%2Fli%3E'
         20        ECHO                                                     ~11
   67    21        ECHO                                                     '%3C%2Ful%3E'
   68    22        ECHO                                                     '%3Cli%3E%3Cp%3Eprinting+%24address-%3EgetAddressText%28%29%3A%3A%3C%2Fp%3E%3C%2Fli%3E'
   69    23        ECHO                                                     '%3Cul%3E'
   70    24        INIT_METHOD_CALL                                         !1, 'getAddressText'
         25        DO_FCALL                                      0  $12     
         26        CONCAT                                           ~13     '%3Cli%3E%3Cp%3E', $12
         27        CONCAT                                           ~14     ~13, '%3C%2Fp%3E%3C%2Fli%3E'
         28        ECHO                                                     ~14
   71    29        ECHO                                                     '%3C%2Ful%3E'
   73    30        ECHO                                                     '%3C%2Fol%3E'
         31      > RETURN                                                   1

Class EmailAddress:
Function getemailaddress:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MDa0M
function name:  getEmailAddress
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   FETCH_OBJ_R                                      ~0      'emailAddress'
          1      > RETURN                                                   ~0
   14     2*     > RETURN                                                   null

End of function getemailaddress

Function setemailaddress:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MDa0M
function name:  setEmailAddress
number of ops:  4
compiled vars:  !0 = $mail
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   RECV                                             !0      
   17     1        ASSIGN_OBJ                                               'emailAddress'
          2        OP_DATA                                                  !0
   18     3      > RETURN                                                   null

End of function setemailaddress

End of class EmailAddress.

Class AddressDisplay:
Function getaddresstype:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MDa0M
function name:  getAddressType
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   26     0  E >   FETCH_OBJ_R                                      ~0      'addressType'
          1      > RETURN                                                   ~0
   27     2*     > RETURN                                                   null

End of function getaddresstype

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

End of function setaddresstype

Function getaddresstext:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MDa0M
function name:  getAddressText
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   34     0  E >   FETCH_OBJ_R                                      ~0      'addressText'
          1      > RETURN                                                   ~0
   35     2*     > RETURN                                                   null

End of function getaddresstext

Function setaddresstext:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MDa0M
function name:  setAddressText
number of ops:  4
compiled vars:  !0 = $mail
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   37     0  E >   RECV                                             !0      
   38     1        ASSIGN_OBJ                                               'addressText'
          2        OP_DATA                                                  !0
   39     3      > RETURN                                                   null

End of function setaddresstext

End of class AddressDisplay.

Class EmailAddressDisplayAdapter:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MDa0M
function name:  __construct
number of ops:  10
compiled vars:  !0 = $mail
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   44     0  E >   RECV                                             !0      
   45     1        INIT_METHOD_CALL                                         'setAddressType'
          2        SEND_VAL_EX                                              'Email'
          3        DO_FCALL                                      0          
   46     4        INIT_METHOD_CALL                                         'setAddressText'
          5        INIT_METHOD_CALL                                         !0, 'getEmailAddress'
          6        DO_FCALL                                      0  $2      
          7        SEND_VAR_NO_REF_EX                                       $2
          8        DO_FCALL                                      0          
   47     9      > RETURN                                                   null

End of function __construct

Function getaddresstype:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MDa0M
function name:  getAddressType
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   26     0  E >   FETCH_OBJ_R                                      ~0      'addressType'
          1      > RETURN                                                   ~0
   27     2*     > RETURN                                                   null

End of function getaddresstype

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

End of function setaddresstype

Function getaddresstext:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MDa0M
function name:  getAddressText
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   34     0  E >   FETCH_OBJ_R                                      ~0      'addressText'
          1      > RETURN                                                   ~0
   35     2*     > RETURN                                                   null

End of function getaddresstext

Function setaddresstext:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MDa0M
function name:  setAddressText
number of ops:  4
compiled vars:  !0 = $mail
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   37     0  E >   RECV                                             !0      
   38     1        ASSIGN_OBJ                                               'addressText'
          2        OP_DATA                                                  !0
   39     3      > RETURN                                                   null

End of function setaddresstext

End of class EmailAddressDisplayAdapter.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.7 ms | 1403 KiB | 13 Q