<p>I'm trying to do this (which produces an unexpected T_VARIABLE error):</p>

<pre><code>public function createShipment($startZip, $endZip, $weight = 
$this-&gt;getDefaultWeight()){}
</code></pre>

<p>I don't want to put a magic number in there for weight since the object I am using has a <code>"defaultWeight"</code> parameter that all new shipments get if you don't specify a weight. I can't put the <code>defaultWeight</code> in the shipment itself, because it changes from shipment group to shipment group. Is there a better way to do it than the following?</p>

<pre><code>public function createShipment($startZip, $endZip, weight = 0){
    if($weight &lt;= 0){
        $weight = $this-&gt;getDefaultWeight();
    }
}
</code></pre>

This isn't much better:
```
```
public function createShipment($startZip, $endZip, $weight=null){
    $weight = !$weight ? $this->getDefaultWeight() : $weight;
}

// or...

public function createShipment($startZip, $endZip, $weight=null){
    if ( !$weight )
        $weight = $this->getDefaultWeight();
}
```
```