3v4l.org

run code in 300+ PHP versions simultaneously
<?php declare(strict_types=1); class ATM { private $trials = 3; private $balance = 100; private $password; private $login; private $pin; public function checkBalance(int $pin, string $password, string $login) { echo '<h1>Witam w banku DSC SA.</h1>'; $this->getPassword(); echo '<p>Prosze wprowadzic login: </p>'; $this->getLogin(); echo '<p>Prosze wprowadzic haslo: </p>'; $this->getPassword(); echo '<p>Prosze wprowadzic PIN: </p>'; $this->getPin(); if ($pin == $this->getPin() && $password == $this->getPassword() && $login == $this->getLogin() ) { echo "Poprawne dane" . PHP_EOL; echo "Saldo konta wynosi: {$this->balance}"; } else { $this->trials--; echo "Niepoprawne dane" . PHP_EOL; echo "Pozostalo {$this->trials} proby"; } } public function getBalance() { return $this->balance = 100; } public function getTrials() { return $this->trials; } private function getLogin() { return $this->login = 'login'; } private function getPassword() { return $this->password = 'secret'; } private function getPin() { return $this->pin = 1234; } } $banco = new ATM(); $banco->checkBalance(1234, 'secret', 'admin');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/JmYG7
function name:  (null)
number of ops:  9
compiled vars:  !0 = $banco
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   65     0  E >   NEW                                              $1      'ATM'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   66     3        INIT_METHOD_CALL                                         !0, 'checkBalance'
          4        SEND_VAL_EX                                              1234
          5        SEND_VAL_EX                                              'secret'
          6        SEND_VAL_EX                                              'admin'
          7        DO_FCALL                                      0          
          8      > RETURN                                                   1

Class ATM:
Function checkbalance:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 19, Position 2 = 23
Branch analysis from position: 19
2 jumps found. (Code = 46) Position 1 = 24, Position 2 = 28
Branch analysis from position: 24
2 jumps found. (Code = 43) Position 1 = 29, Position 2 = 35
Branch analysis from position: 29
1 jumps found. (Code = 42) Position 1 = 42
Branch analysis from position: 42
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 35
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 28
Branch analysis from position: 23
filename:       /in/JmYG7
function name:  checkBalance
number of ops:  43
compiled vars:  !0 = $pin, !1 = $password, !2 = $login
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
   14     3        ECHO                                                     '%3Ch1%3EWitam+w+banku+DSC+SA.%3C%2Fh1%3E'
   15     4        INIT_METHOD_CALL                                         'getPassword'
          5        DO_FCALL                                      0          
   17     6        ECHO                                                     '%3Cp%3EProsze+wprowadzic+login%3A+%3C%2Fp%3E'
   18     7        INIT_METHOD_CALL                                         'getLogin'
          8        DO_FCALL                                      0          
   20     9        ECHO                                                     '%3Cp%3EProsze+wprowadzic+haslo%3A+%3C%2Fp%3E'
   21    10        INIT_METHOD_CALL                                         'getPassword'
         11        DO_FCALL                                      0          
   23    12        ECHO                                                     '%3Cp%3EProsze+wprowadzic+PIN%3A+%3C%2Fp%3E'
   24    13        INIT_METHOD_CALL                                         'getPin'
         14        DO_FCALL                                      0          
   27    15        INIT_METHOD_CALL                                         'getPin'
         16        DO_FCALL                                      0  $7      
         17        IS_EQUAL                                         ~8      !0, $7
         18      > JMPZ_EX                                          ~8      ~8, ->23
   28    19    >   INIT_METHOD_CALL                                         'getPassword'
         20        DO_FCALL                                      0  $9      
         21        IS_EQUAL                                         ~10     !1, $9
         22        BOOL                                             ~8      ~10
         23    > > JMPZ_EX                                          ~8      ~8, ->28
   29    24    >   INIT_METHOD_CALL                                         'getLogin'
         25        DO_FCALL                                      0  $11     
         26        IS_EQUAL                                         ~12     !2, $11
         27        BOOL                                             ~8      ~12
         28    > > JMPZ                                                     ~8, ->35
   31    29    >   ECHO                                                     'Poprawne+dane%0A'
   32    30        NOP                                                      
         31        FETCH_OBJ_R                                      ~13     'balance'
         32        FAST_CONCAT                                      ~14     'Saldo+konta+wynosi%3A+', ~13
         33        ECHO                                                     ~14
         34      > JMP                                                      ->42
   34    35    >   PRE_DEC_OBJ                                              'trials'
   35    36        ECHO                                                     'Niepoprawne+dane%0A'
   36    37        ROPE_INIT                                     3  ~18     'Pozostalo+'
         38        FETCH_OBJ_R                                      ~16     'trials'
         39        ROPE_ADD                                      1  ~18     ~18, ~16
         40        ROPE_END                                      2  ~17     ~18, '+proby'
         41        ECHO                                                     ~17
   38    42    > > RETURN                                                   null

End of function checkbalance

Function getbalance:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/JmYG7
function name:  getBalance
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   42     0  E >   ASSIGN_OBJ                                       ~0      'balance'
          1        OP_DATA                                                  100
          2      > RETURN                                                   ~0
   43     3*     > RETURN                                                   null

End of function getbalance

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

End of function gettrials

Function getlogin:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/JmYG7
function name:  getLogin
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   52     0  E >   ASSIGN_OBJ                                       ~0      'login'
          1        OP_DATA                                                  'login'
          2      > RETURN                                                   ~0
   53     3*     > RETURN                                                   null

End of function getlogin

Function getpassword:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/JmYG7
function name:  getPassword
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   57     0  E >   ASSIGN_OBJ                                       ~0      'password'
          1        OP_DATA                                                  'secret'
          2      > RETURN                                                   ~0
   58     3*     > RETURN                                                   null

End of function getpassword

Function getpin:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/JmYG7
function name:  getPin
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   62     0  E >   ASSIGN_OBJ                                       ~0      'pin'
          1        OP_DATA                                                  1234
          2      > RETURN                                                   ~0
   63     3*     > RETURN                                                   null

End of function getpin

End of class ATM.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
168.4 ms | 1403 KiB | 13 Q