3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php interface czlowiek { function a(); function b(); }; class dupa implements czlowiek{ public function a() {} public function b(){} public $a; public static $NICE = 'STATIC_VALUE'; public function __construct($param) { if(preg_match('/^[bla]+/',$param)){ $this->a = $param; echo '+_construct'.$this->a.self::$NICE; } else { echo 'dupa'; } } public static function statek(){ echo "\nWywolano metode statyczna"; } public function __call($a, $b) { echo "\n".'Wywolano metodÄ™ \''.$a.'\' z parametrami:'."\n"; foreach($b as $i=>$val) { echo 'indeks: '.$i.' wartosc: '.$val."\n"; } } public function setA($a) { $this->a = $a; } }; $a = new dupa('ablabla'); echo $a->a; $b = new dupa(''); echo $b->a; $b->setA('bb'); $b->setb('bb',8,true); echo dupa::$NICE; dupa::statek(); ?>
Output for 5.0.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
+_constructablablaSTATIC_VALUEablabladupa Wywolano metodÄ™ 'setb' z parametrami: indeks: 0 wartosc: bb indeks: 1 wartosc: 8 indeks: 2 wartosc: 1 STATIC_VALUE Wywolano metode statyczna
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_STRING in /in/7SgE7 on line 2
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 in /in/7SgE7 on line 2
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/7SgE7 on line 2
Process exited with code 255.