3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Account { private $account_number; private $balance; private $branch; private $account_owner; private $atm_issued; function __construct($account_number,$balance,$branch,$account_owner,$atm_issued) { if($account_owner instanceof AccountHolder) { $this->account_number = $account_number; $this->balance = $balance; $this->branch = $branch; $this->account_owner = $account_owner; $this->account_owner->setAccount($this); $this->atm_issued = $atm_issued; } else { echo "Not a valid accountholder"; die(); } } } class SavingsAccount extends Account { private static $type = "SavingsAccount"; public static function getTypeOfAccount() { return self::$type; } } class CurrentAccount extends Account { private static $type = "CurrentAccount"; public static function getTypeOfAccount() { return self::$type; } } class AccountHolder { private $fullname; private $age; private $mobile; private $account; function __construct($name,$age,$mobile) { $this->fullname = $name; $this->age = $age; $this->mobile = $mobile; } public function setAccount($account) { $this->account = $account; } } $person_1 = new AccountHolder("James",21,9495786); $account_1 = new CurrentAccount(123456,7896.00,"Kochi",$person_1,false); $person_2 = new AccountHolder("John",29,974767345); $account_2 = new SavingsAccount(978563,18765.00,"Pala",$person_2,true); 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/4jrYk
function name:  (null)
number of ops:  35
compiled vars:  !0 = $person_1, !1 = $account_1, !2 = $person_2, !3 = $account_2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   68     0  E >   NEW                                              $4      'AccountHolder'
          1        SEND_VAL_EX                                              'James'
          2        SEND_VAL_EX                                              21
          3        SEND_VAL_EX                                              9495786
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !0, $4
   69     6        NEW                                              $7      'CurrentAccount'
          7        SEND_VAL_EX                                              123456
          8        SEND_VAL_EX                                              7896
          9        SEND_VAL_EX                                              'Kochi'
         10        SEND_VAR_EX                                              !0
         11        SEND_VAL_EX                                              <false>
         12        DO_FCALL                                      0          
         13        ASSIGN                                                   !1, $7
   70    14        NEW                                              $10     'AccountHolder'
         15        SEND_VAL_EX                                              'John'
         16        SEND_VAL_EX                                              29
         17        SEND_VAL_EX                                              974767345
         18        DO_FCALL                                      0          
         19        ASSIGN                                                   !2, $10
   71    20        NEW                                              $13     'SavingsAccount'
         21        SEND_VAL_EX                                              978563
         22        SEND_VAL_EX                                              18765
         23        SEND_VAL_EX                                              'Pala'
         24        SEND_VAR_EX                                              !2
         25        SEND_VAL_EX                                              <true>
         26        DO_FCALL                                      0          
         27        ASSIGN                                                   !3, $13
   72    28        INIT_FCALL                                               'print_r'
         29        SEND_VAR                                                 !1
         30        DO_ICALL                                                 
   73    31        INIT_FCALL                                               'print_r'
         32        SEND_VAR                                                 !3
         33        DO_ICALL                                                 
   74    34      > RETURN                                                   1

Class Account:
Function __construct:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 23
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 25
Branch analysis from position: 25
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 23
1 jumps found. (Code = 79) Position 1 = -2
filename:       /in/4jrYk
function name:  __construct
number of ops:  26
compiled vars:  !0 = $account_number, !1 = $balance, !2 = $branch, !3 = $account_owner, !4 = $atm_issued
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
          3        RECV                                             !3      
          4        RECV                                             !4      
   14     5        INSTANCEOF                                               !3, 'AccountHolder'
          6      > JMPZ                                                     ~5, ->23
   15     7    >   ASSIGN_OBJ                                               'account_number'
          8        OP_DATA                                                  !0
   16     9        ASSIGN_OBJ                                               'balance'
         10        OP_DATA                                                  !1
   17    11        ASSIGN_OBJ                                               'branch'
         12        OP_DATA                                                  !2
   18    13        ASSIGN_OBJ                                               'account_owner'
         14        OP_DATA                                                  !3
   19    15        FETCH_OBJ_R                                      ~10     'account_owner'
         16        INIT_METHOD_CALL                                         ~10, 'setAccount'
         17        FETCH_THIS                                       $11     
         18        SEND_VAR_EX                                              $11
         19        DO_FCALL                                      0          
   20    20        ASSIGN_OBJ                                               'atm_issued'
         21        OP_DATA                                                  !4
         22      > JMP                                                      ->25
   23    23    >   ECHO                                                     'Not+a+valid+accountholder'
   24    24      > EXIT                                                     
   26    25    > > 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/4jrYk
function name:  getTypeOfAccount
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   34     0  E >   FETCH_STATIC_PROP_R          unknown             ~0      'type'
          1      > RETURN                                                   ~0
   35     2*     > RETURN                                                   null

End of function gettypeofaccount

Function __construct:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 23
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 25
Branch analysis from position: 25
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 23
1 jumps found. (Code = 79) Position 1 = -2
filename:       /in/4jrYk
function name:  __construct
number of ops:  26
compiled vars:  !0 = $account_number, !1 = $balance, !2 = $branch, !3 = $account_owner, !4 = $atm_issued
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
          3        RECV                                             !3      
          4        RECV                                             !4      
   14     5        INSTANCEOF                                               !3, 'AccountHolder'
          6      > JMPZ                                                     ~5, ->23
   15     7    >   ASSIGN_OBJ                                               'account_number'
          8        OP_DATA                                                  !0
   16     9        ASSIGN_OBJ                                               'balance'
         10        OP_DATA                                                  !1
   17    11        ASSIGN_OBJ                                               'branch'
         12        OP_DATA                                                  !2
   18    13        ASSIGN_OBJ                                               'account_owner'
         14        OP_DATA                                                  !3
   19    15        FETCH_OBJ_R                                      ~10     'account_owner'
         16        INIT_METHOD_CALL                                         ~10, 'setAccount'
         17        FETCH_THIS                                       $11     
         18        SEND_VAR_EX                                              $11
         19        DO_FCALL                                      0          
   20    20        ASSIGN_OBJ                                               'atm_issued'
         21        OP_DATA                                                  !4
         22      > JMP                                                      ->25
   23    23    >   ECHO                                                     'Not+a+valid+accountholder'
   24    24      > EXIT                                                     
   26    25    > > 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/4jrYk
function name:  getTypeOfAccount
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   44     0  E >   FETCH_STATIC_PROP_R          unknown             ~0      'type'
          1      > RETURN                                                   ~0
   45     2*     > RETURN                                                   null

End of function gettypeofaccount

Function __construct:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 23
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 25
Branch analysis from position: 25
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 23
1 jumps found. (Code = 79) Position 1 = -2
filename:       /in/4jrYk
function name:  __construct
number of ops:  26
compiled vars:  !0 = $account_number, !1 = $balance, !2 = $branch, !3 = $account_owner, !4 = $atm_issued
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
          3        RECV                                             !3      
          4        RECV                                             !4      
   14     5        INSTANCEOF                                               !3, 'AccountHolder'
          6      > JMPZ                                                     ~5, ->23
   15     7    >   ASSIGN_OBJ                                               'account_number'
          8        OP_DATA                                                  !0
   16     9        ASSIGN_OBJ                                               'balance'
         10        OP_DATA                                                  !1
   17    11        ASSIGN_OBJ                                               'branch'
         12        OP_DATA                                                  !2
   18    13        ASSIGN_OBJ                                               'account_owner'
         14        OP_DATA                                                  !3
   19    15        FETCH_OBJ_R                                      ~10     'account_owner'
         16        INIT_METHOD_CALL                                         ~10, 'setAccount'
         17        FETCH_THIS                                       $11     
         18        SEND_VAR_EX                                              $11
         19        DO_FCALL                                      0          
   20    20        ASSIGN_OBJ                                               'atm_issued'
         21        OP_DATA                                                  !4
         22      > JMP                                                      ->25
   23    23    >   ECHO                                                     'Not+a+valid+accountholder'
   24    24      > EXIT                                                     
   26    25    > > 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/4jrYk
function name:  __construct
number of ops:  10
compiled vars:  !0 = $name, !1 = $age, !2 = $mobile
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   55     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
   57     3        ASSIGN_OBJ                                               'fullname'
          4        OP_DATA                                                  !0
   58     5        ASSIGN_OBJ                                               'age'
          6        OP_DATA                                                  !1
   59     7        ASSIGN_OBJ                                               'mobile'
          8        OP_DATA                                                  !2
   60     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/4jrYk
function name:  setAccount
number of ops:  4
compiled vars:  !0 = $account
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   62     0  E >   RECV                                             !0      
   63     1        ASSIGN_OBJ                                               'account'
          2        OP_DATA                                                  !0
   64     3      > RETURN                                                   null

End of function setaccount

End of class AccountHolder.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
168.83 ms | 1408 KiB | 15 Q