Am learning how namespace works and have three files:- index, iClass, and iClassed
iClass.php
<?php
namespace app\ic;
class iClass {
public static function callMeFromClass() {
echo 'OK - you have called me!';
exit;
}
}
iClassed.php
<?php
namespace app\icl;
class iClass {
public static function callMe() {
echo 'OK - iclassed - you have called me!';
exit;
}
}
and the index.php
<?php
namespace inex;
require_once 'iClass.php';
require_once 'iClassed.php';
use app\ic\iClass;
iClass::callMeFromClass();
use app\icl\iClass;
iClass::callMe();
The error that I get after I try to run is
Cannot use app\icl\iClass as iClass because the name is already in use in C:\xampp\htdocs amespace\index.php on line 10
Can somebody explain why the error.