[thelist] [ot] Mac Antivirus
Maximillian Schwanekamp
lists at neptunewebworks.com
Thu Mar 10 14:12:57 CST 2005
Sorry for the OT post. A Mac-using client has finally moved to OS X,
and is wondering about antivirus software, anything but Norton (her
req). Any enthusastic recommendations? Replies offlist, please.
<tip type="Use References in Object instantiation in PHP" author="Max
Schwanekamp">
When you pass a variable in PHP, by default PHP creates a copy of it.
So when you instantiate an object like this:
$foo = new Bar();
PHP instantiates Bar, and creates a copy of it when passing it to $foo,
so that $foo and the result of new Bar() have equivalent values (but
sepearate).
Generally this is no big deal, but if Bar is a fairly large object, this
can create some unnecessary overhead. Simple solution, pass by
reference instead:
$foo =& new Bar();
That little ampersand says that $foo and new Bar() refer to the exact
same object, avoiding the need for a copy to be created. (btw, most
code uses "= &new" instead of "=& new". Result is the same.)
</tip>
--
Maximillian Von Schwanekamp
http://www.neptunewebworks.com/
More information about the thelist
mailing list