<?php
final class dupa {
public $a;
public static $NICE = 'STATIC_VALUE';
public function __construct($param) {
$this->a = $param;
echo '+_construct'.$this->a.self::$NICE;
}
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('blabla');
echo $a->a;
$b = new dupa('');
echo $b->a;
$b->setA('bb');
$b->setb('bb',8,true,new dupa(''));
?>
+_constructblablaSTATIC_VALUEblabla+_constructSTATIC_VALUE+_constructSTATIC_VALUE
Wywolano metodę setb z parametrami:
indeks: 0wartosc: bb
indeks: 1wartosc: 8
indeks: 2wartosc: 1
Fatal error: Uncaught Error: Object of class dupa could not be converted to string in /in/jqB8c:15
Stack trace:
#0 /in/jqB8c(29): dupa->__call('setb', Array)
#1 {main}
thrown in /in/jqB8c on line 15
Process exited with code 255.
+_constructblablaSTATIC_VALUEblabla+_constructSTATIC_VALUE+_constructSTATIC_VALUE
Wywolano metodę setb z parametrami:
indeks: 0wartosc: bb
indeks: 1wartosc: 8
indeks: 2wartosc: 1
Recoverable fatal error: Object of class dupa could not be converted to string in /in/jqB8c on line 15
Process exited with code 255.
+_constructblablaSTATIC_VALUEblabla+_constructSTATIC_VALUE+_constructSTATIC_VALUE
Wywolano metodę setb z parametrami:
indeks: 0wartosc: bb
indeks: 1wartosc: 8
indeks: 2wartosc: 1
Catchable fatal error: Object of class dupa could not be converted to string in /in/jqB8c on line 15
Process exited with code 255.
Output for 5.0.0 - 5.0.5, 5.1.0 - 5.1.6
+_constructblablaSTATIC_VALUEblabla+_constructSTATIC_VALUE+_constructSTATIC_VALUE
Wywolano metodę setb z parametrami:
indeks: 0wartosc: bb
indeks: 1wartosc: 8
indeks: 2wartosc: 1
indeks: 3wartosc: Object id #3
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_CLASS in /in/jqB8c on line 3
Process exited with code 255.