07 Sep

quick php efficiency tip

Rewrote some code today. It was a bit long-winded.

It was:

 $name=getVar('name');
 $id=getVar('id');
 $start=getVar('start');
 $action=getVar('action');

Rewrote to:

 foreach(array('name','id','start','action') as $v)$$v=getVar($v);

This method can be used to really help clean up longwinded variable initialisations.