Home > Article > Backend Development > What is the php initialization method?
php initialization method: Use the constructor construct to implement, the code is [public function __construct($count,$money){$this->count = $count;$this->money = $money; }].
php initialization method:
Use the constructor construct to achieve
<?php class Saler{ public function __construct($count,$money){ #初始化方法 $this->count = $count; $this->money = $money; } } $s1 = new Saler(100,100); $s2 = new Saler(1000,1000); $s1->__construct(1000,1000); var_dump($s1,$s2);
Think To learn more about programming learning, please pay attention to the php training column!
The above is the detailed content of What is the php initialization method?. For more information, please follow other related articles on the PHP Chinese website!