PHP支持复合数据类型吗


Does PHP support Composite Data Type?

PHP支持复合数据类型吗?如果是,那么我该如何创建它?

假设复合数据类型指的是对象,那么PHP确实支持它们。为了创建对象,必须创建类。例如:

class SimpleClass
    {
      // property declaration
       public $var = 'a default value';
       // method declaration
       public function displayVar() {
          echo $this->var;
       }
    }

然后,您可以实例化此类的对象,如下所示:CCD_ 1。有关详细信息:http://php.net/manual/en/language.oop5.php