<?php
// Everything you enter here will be executed by our servers. Try it!
class A
{
private $a;
private $b;
public function __construct()
{
$this->a = 1;
$this->b = 2;
}
public function __get($name)
{
switch ($name)
{
// protected:
case 'a':
return $this->a;
break;
// public
case 'b':
return $this->b;
break;
}
}
}
class B extends A
{
public function getA()
{
return $this->a;
}
}
$B = new B();
echo $B->b . "\n"; // valid
echo $B->a . "\n"; // shouldn't be possible
echo $B->getA() . "\n"; // valid
Fatal error: fatal flex scanner internal error--end of buffer missed in /in/Odehk on line 44
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/Odehk on line 6
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/Odehk on line 6
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/Odehk on line 6
Process exited with code 255.