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 = 'admin'; } private function getPassword() { return $this->password = 'secret'; } private function getPin() { return $this->pin = 1234; } } $banco = new ATM(); $banco->checkBalance(1234, 'secret', 'admin');
Output for git.master, git.master_jit, rfc.property-hooks
<h1>Witam w banku DSC SA.</h1><p>Prosze wprowadzic login: </p><p>Prosze wprowadzic haslo: </p><p>Prosze wprowadzic PIN: </p>Poprawne dane Saldo konta wynosi: 100

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
48.42 ms | 401 KiB | 8 Q