I want my code to display "yes" if the scan function as the namespace "Imperium" as a parameter and displays "no" if it doesn't match Imperium
Here is what I tried:
namespace Imperium;
class Soldier
{
public function getNameSpace()
{
return __NAMESPACE__;
}
}
namespace Chaos;
class Soldier
{
public function getNameSpace()
{
return __NAMESPACE__;
}
}
class Scanner
{
public function scan($Soldier)
{
if ($Soldier->getNameSpace() == "Imperium")
{
echo "yes
";
}
else
{
echo "no
";
}
}
}
$scan = new Scanner();
$scan -> scan(Imperium);
ERROR I get
PHP Fatal error: Uncaught Error: Call to a member function getNameSpace()