定义了一个类
class myclass{ function test() echo "good";}$test1="myclass";$test2=new myclass();
你分??出那???量就知道啦
$test1只是字符串
$test2是类的实例,是个对象
对两者gettype()可以看出区别
<?phpclass MyClassq{ const constant = 'constant value'; function showConstant() { echo self::constant . "\n"; }}echo MyClassq::constant . "\n";$classname = "MyClassq";echo $classname::constant . "\n"; // PHP 5.3.0之后$class = new MyClassq();$class->showConstant();echo $class::constant."\n"; // PHP 5.3.0之后?> 复习一下“变量的变量”
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号