Welcome Guest, Not a member yet? Register   Sign In
What is faster?
#1

[eluser]SeanJA[/eluser]
I have always been curious, which way is faster?

Code:
<td> &lt;input size='25' name='department' value='&lt;?php echo $user-&gt;department ?&gt;'  /> </td>

or

Code:
&lt;?php echo "<td> &lt;input size='25' name='department' value='",$user-&gt;department,"  /> </td>"; ?&gt;

I generally use the first way, but working in a group there is a lot of code that ends up looking like the second one...
#2

[eluser]parrots[/eluser]
I would assume the first is faster. Where you really start to notice a speed difference in where you're having lots of opening and closing of PHP blocks near each other -- in that case you'd want one PHP block with multiple echos (or one long one if applicable).
#3

[eluser]EEssam[/eluser]
[quote author="parrots" date="1214620861"]Where you really start to notice a speed difference in where you're having lots of opening and closing of PHP blocks near each other[/quote]

I guess the difference is a few milliseconds, right?
#4

[eluser]parrots[/eluser]
Right, but it can add up quickly if you're getting lots of hits and you do it a lot. It's not a huge performance hit, but every little bit adds up.




Theme © iAndrew 2016 - Forum software by © MyBB