tags:

views:

37

answers:

2

What does

$shipping_modules = new shipping($shipping);

mean?

I know its silly but pls help...

+6  A: 

...

$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

Sarfraz
+3  A: 

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
Palantir