Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
April 16, 2010, 11:04 pm
rate this thread
$Unit is a simple xml object.
... slower than this?
<?php $rent = $Unit->Rent ?>
(excuse the nasty CamelCasing, client rules)
- Thomas 'PointedEars' Lahn
April 16, 2010, 11:40 pm
Couldn't you be a bit less specific?
Probably yes, because $Unit only needs to be resolved once and the property
access $Unit->Rent only needs to take place once (use your brain!). It is
also a bit easier to maintain.
However, this has nothing to do with pointers (there are none in PHP) or
references (would need to be $rent =& $Unit->Rent to have one).
Avoid short_open_tag=1 and using the short-tag syntax for production code:
And what is the <br> doing in there? Formatting should be done with CSS,
not markup, and data storage should be independent of presentation.
At least keep your identifiers consistent. You are assigning to $rent, but
refer to $Rent.
Danny Goodman's books are out of date and teach practices that are
positively harmful for cross-browser scripting.
First of all, don't use short open tags - you shoujld have:
<?php echo $Unit->rent;?>
Second of all, what does it matter? Do you have a performance problem?
Or are you prematurely optimizing?
Code for clarity and maintainability. Then if you have a performance
problem, find it and fix it. It won't be in code such as you show here.
Remove the "x" from my email address
JDS Computer Training Corp.