任务:
创建file1.php, file2.php, file3.php 分别定义不同的命名空间 分别定义⽅法:foo(),定义类Demo,定义常量NUMBER 创建main.php,并在其中引⼊file123,并分别调⽤其中的⽅法,创建类并输出常量。
file1.php
file2.php
name = "class defined in task1\\file2\\Demo";
}
public function speak(string $na){
echo $na. " is an object from ".$this->name . "\n";
}
}
?>
file3.php
main.php
\n";
$demo1=new task1\File2\Demo();
$demo1->speak("demo1");
echo "\n";
use const task1\File3\NUMBER as number1;
echo number1."\n";
echo "\n";
?>