开发者

What does $shipping_modules = new shipping($shipping); mean?

What does the following code mean?

开发者_高级运维
$shipping_modules = new shipping($shipping);


...

$shipping_modules = new shipping($shipping);

The new instance of class shipping is assigned to variable $shipping_modules there by allowing you to access class methods/properties. Finally, $shipping variable is passed to the constructor of shipping class.

$shipping_modules = new shipping($shipping);
        1            2      3        4         

where:

  1. assigns new instance of shipping class to $shipping_modules variable
  2. new operator to create instance of the class
  3. The class name eg shipping
  4. The variable $shipping passed to constructor of the class.

See PHP OOP Tutorial


It means:

  1. Create a new shipping object
  2. In doing so, pass the $shipping variable to the __construct function of the shipping object
  3. Then assign this new object to the $shipping_modules variable
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜