Language is PHP 5.4 on an Apache 2.2 server. It\'s a script being called by ajax.
$usr = new User(); function getMyName(){ echo $usr->username; } getMyNa
$usr = new User(); function getMyName(){ global $usr; echo $usr->username; } getMyName();
alternatively:
$usr = new User(); function getMyName($usr){ echo $usr->username; } getMyName($usr);