<?php
// Mutable class (example)
class Foo
{
protected $bar;
public function getBar()
{
return $this->bar;
}
public function setBar($newBar)
{
$this->bar = $newBar;
}
}
function demo(Foo $foo)
{
$foo->setBar('new value');
}
$foo = new Foo();
$foo->setBar('first value');
demo($foo);
// The value has changed to 'new value'
echo $foo->getBar();
Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/tPPpO on line 7
Process exited with code 255.
Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/tPPpO on line 7
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/tPPpO on line 7
Process exited with code 255.