3v4l.org

run code in 300+ PHP versions simultaneously
<?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 git.master, git.master_jit, rfc.property-hooks
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.

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:
41.73 ms | 401 KiB | 8 Q