3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Account { private $accNumber; private $bal; private $branch; private $accOwner; function __construct($accNumber,$bal,$branch,$accOwner) { $this->accNumber = $accNumber; $this->bal = $bal; $this->branch = $branch; $this->accOwner = $accOwner; $this->accOwner->setAccount($this); } } class SavingsAccount extends Account { private $type = "SavingsAccount"; public function getTypeOfAccount() { return $this->$type; } } class CurrentAccount extends Account { private $type = "CurrentAccount"; public function getTypeOfAccount() { return $this->$type; } } class AccountHolder { private $name; private $age; private $mob; private $account; function __construct($name,$age,$mob) { $this->full = $name; $this->age = $age; $this->mob = $mob; } public function setAccount($account) { $this->account = $account; } } $person_1 = new AccountHolder("Nevil",29,933338787); $account_1 = new CurrentAccount(111111,77896.00,"Kaloor",$person_1); $person_2 = new AccountHolder("Chitra",23,9878787345); $account_2 = new SavingsAccount(222222,18765.00,"Edapally",$person_2); print_r($account_1); print_r($account_2); ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/RS12c
function name:  (null)
number of ops:  33
compiled vars:  !0 = $person_1, !1 = $account_1, !2 = $person_2, !3 = $account_2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   63     0  E >   NEW                                              $4      'AccountHolder'
          1        SEND_VAL_EX                                              'Nevil'
          2        SEND_VAL_EX                                              29
          3        SEND_VAL_EX                                              933338787
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !0, $4
   64     6        NEW                                              $7      'CurrentAccount'
          7        SEND_VAL_EX                                              111111
          8        SEND_VAL_EX                                              77896
          9        SEND_VAL_EX                                              'Kaloor'
         10        SEND_VAR_EX                                              !0
         11        DO_FCALL                                      0          
         12        ASSIGN                                                   !1, $7
   65    13        NEW                                              $10     'AccountHolder'
         14        SEND_VAL_EX                                              'Chitra'
         15        SEND_VAL_EX                                              23
         16        SEND_VAL_EX                                              9878787345
         17        DO_FCALL                                      0          
         18        ASSIGN                                                   !2, $10
   66    19        NEW                                              $13     'SavingsAccount'
         20        SEND_VAL_EX                                              222222
         21        SEND_VAL_EX                                              18765
         22        SEND_VAL_EX                                              'Edapally'
         23        SEND_VAR_EX                                              !2
         24        DO_FCALL                                      0          
         25        ASSIGN                                                   !3, $13
   67    26        INIT_FCALL                                               'print_r'
         27        SEND_VAR                                                 !1
         28        DO_ICALL                                                 
   68    29        INIT_FCALL                                               'print_r'
         30        SEND_VAR                                                 !3
         31        DO_ICALL                                                 
   69    32      > RETURN                                                   1

Class Account:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/RS12c
function name:  __construct
number of ops:  18
compiled vars:  !0 = $accNumber, !1 = $bal, !2 = $branch, !3 = $accOwner
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
          3        RECV                                             !3      
   15     4        ASSIGN_OBJ                                               'accNumber'
          5        OP_DATA                                                  !0
   16     6        ASSIGN_OBJ                                               'bal'
          7        OP_DATA                                                  !1
   17     8        ASSIGN_OBJ                                               'branch'
          9        OP_DATA                                                  !2
   18    10        ASSIGN_OBJ                                               'accOwner'
         11        OP_DATA                                                  !3
   19    12        FETCH_OBJ_R                                      ~8      'accOwner'
         13        INIT_METHOD_CALL                                         ~8, 'setAccount'
         14        FETCH_THIS                                       $9      
         15        SEND_VAR_EX                                              $9
         16        DO_FCALL                                      0          
   21    17      > RETURN                                                   null

End of function __construct

End of class Account.

Class SavingsAccount:
Function gettypeofaccount:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/RS12c
function name:  getTypeOfAccount
number of ops:  3
compiled vars:  !0 = $type
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   29     0  E >   FETCH_OBJ_R                                      ~1      !0
          1      > RETURN                                                   ~1
   30     2*     > RETURN                                                   null

End of function gettypeofaccount

Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/RS12c
function name:  __construct
number of ops:  18
compiled vars:  !0 = $accNumber, !1 = $bal, !2 = $branch, !3 = $accOwner
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
          3        RECV                                             !3      
   15     4        ASSIGN_OBJ                                               'accNumber'
          5        OP_DATA                                                  !0
   16     6        ASSIGN_OBJ                                               'bal'
          7        OP_DATA                                                  !1
   17     8        ASSIGN_OBJ                                               'branch'
          9        OP_DATA                                                  !2
   18    10        ASSIGN_OBJ                                               'accOwner'
         11        OP_DATA                                                  !3
   19    12        FETCH_OBJ_R                                      ~8      'accOwner'
         13        INIT_METHOD_CALL                                         ~8, 'setAccount'
         14        FETCH_THIS                                       $9      
         15        SEND_VAR_EX                                              $9
         16        DO_FCALL                                      0          
   21    17      > RETURN                                                   null

End of function __construct

End of class SavingsAccount.

Class CurrentAccount:
Function gettypeofaccount:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/RS12c
function name:  getTypeOfAccount
number of ops:  3
compiled vars:  !0 = $type
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   39     0  E >   FETCH_OBJ_R                                      ~1      !0
          1      > RETURN                                                   ~1
   40     2*     > RETURN                                                   null

End of function gettypeofaccount

Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/RS12c
function name:  __construct
number of ops:  18
compiled vars:  !0 = $accNumber, !1 = $bal, !2 = $branch, !3 = $accOwner
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
          3        RECV                                             !3      
   15     4        ASSIGN_OBJ                                               'accNumber'
          5        OP_DATA                                                  !0
   16     6        ASSIGN_OBJ                                               'bal'
          7        OP_DATA                                                  !1
   17     8        ASSIGN_OBJ                                               'branch'
          9        OP_DATA                                                  !2
   18    10        ASSIGN_OBJ                                               'accOwner'
         11        OP_DATA                                                  !3
   19    12        FETCH_OBJ_R                                      ~8      'accOwner'
         13        INIT_METHOD_CALL                                         ~8, 'setAccount'
         14        FETCH_THIS                                       $9      
         15        SEND_VAR_EX                                              $9
         16        DO_FCALL                                      0          
   21    17      > RETURN                                                   null

End of function __construct

End of class CurrentAccount.

Class AccountHolder:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/RS12c
function name:  __construct
number of ops:  10
compiled vars:  !0 = $name, !1 = $age, !2 = $mob
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   50     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
   52     3        ASSIGN_OBJ                                               'full'
          4        OP_DATA                                                  !0
   53     5        ASSIGN_OBJ                                               'age'
          6        OP_DATA                                                  !1
   54     7        ASSIGN_OBJ                                               'mob'
          8        OP_DATA                                                  !2
   55     9      > RETURN                                                   null

End of function __construct

Function setaccount:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/RS12c
function name:  setAccount
number of ops:  4
compiled vars:  !0 = $account
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   57     0  E >   RECV                                             !0      
   58     1        ASSIGN_OBJ                                               'account'
          2        OP_DATA                                                  !0
   59     3      > RETURN                                                   null

End of function setaccount

End of class AccountHolder.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
173 ms | 1408 KiB | 15 Q