<?php
class test
{
private $foo;
protected $bar;
public function toarray()
{
return get_object_vars($this);
}
}
class inheritedTest extends test
{
private $baz;
protected $baf;
public function toarray()
{
return get_object_vars($this);
}
}
$test=new Test();
$vars = $test->toarray(); //does acccess private, protected
var_dump($vars);
$itest= new inheritedTest();
$vars = $itest->toArray(); // does access protected but not private
var_dump($vars);
Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/5mKQ6 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/5mKQ6 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/5mKQ6 on line 6
Process exited with code 255.