3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class TiroNaCara extends Exception { public function __construct($grito){ parent::__construct("Você levou tiro na cara: " . strtoupper($grito)); } } class LojaDeCrack { private $pacotes = array(); private function checarPacotes($oQueFazer){ $pacotes = $this -> pacotes; foreach($pacotes as $pedraDoPacote) $oQueFazer($pedraDoPacote); } public function __construct($pacotes){ if(gettype($pacotes) == "array" && !empty($pacotes)){ checarPacotes(function($pedraDoPacote){ if(!is_numeric($pedraDoPacote)) throw new TiroNaCara("CLIENTE BURRO DO CARALHUDO DE UMAS ARÁBIAS! AFF"); }); $this -> pacotes = $pacotes; }else throw new TiroNaCara("TEM ALGO DE ERRADO COM OS MEUS PACOTES... SEU CRACKUDO FILHO DA PUTA!"); } public function comprarPedra($pedras){ if(is_numeric($pedras)){ $pacotes = $this -> pacotes; foreach($pacotes as $pedraDoPacote){ if($pedraDoPacote <= $pedras){ $resto = $pedras%$pedraDoPacote; if($resto) comprarPedra($resto); } } }else throw new TiroNaCara("TA ME TIRANDO, FILHO DA PUTA?!"); } } try{ $crack = new LojaDeCrack(array(20, 10, 7, '')); }catch(Exception $e){ echo $e -> getMessage(); } ?>
Output for 7.0.0 - 7.1.0
Fatal error: Uncaught Error: Call to undefined function checarPacotes() in /in/SCdDG:18 Stack trace: #0 /in/SCdDG(43): LojaDeCrack->__construct(Array) #1 {main} thrown in /in/SCdDG on line 18
Process exited with code 255.
Output for hhvm-3.12.0
Fatal error: Uncaught Error: Call to undefined function checarPacotes() in /in/SCdDG:21 Stack trace: #0 /in/SCdDG(43): LojaDeCrack->__construct() #1 {main}
Process exited with code 255.
Output for hhvm-3.10.0
Fatal error: Call to undefined function checarPacotes() in /in/SCdDG on line 21
Process exited with code 255.
Output for 5.3.0 - 5.6.28
Fatal error: Call to undefined function checarPacotes() in /in/SCdDG on line 18
Process exited with code 255.
Output for 5.1.0 - 5.2.17
Parse error: syntax error, unexpected T_FUNCTION, expecting ')' in /in/SCdDG on line 18
Process exited with code 255.
Output for 5.0.0 - 5.0.5
Parse error: parse error, unexpected T_FUNCTION, expecting ')' in /in/SCdDG on line 18
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/SCdDG on line 3
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/SCdDG on line 3
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or `T_VAR' or `'}'' in /in/SCdDG on line 3
Process exited with code 255.