class ClassName
{
public function check()
{
$user = true;
if ($user = true) {
function user()
{
echo "string";
}
} else {
header('Location: example.com');
}
}
}
$a = new ClassName;
$a->check()->user();
class ClassName
{
public function check()
{
$var = 2;
if ($var = 2) {
$this->user();
} else {
header('Location: example.com');
}
}
private function user()
{
echo "string";
}
}
$a = new ClassName;
$a->check();