<?=$item ?> or <?php echo $item;?> witch is faster ?

#1
[eluser]Evollution[/eluser]
<?=$item ?> or <?php echo $item;?>

witch variant is faster ?!

#2
[eluser]mdvaldosta[/eluser]
I doubt theirs a measurable difference, but if anything <?php would be faster because it doesn't have to get converted from short tags. I think you're splitting hairs with that kind of optimization. Having said that though, I always use the full <?php ?> tags as a habit because not all server settings allow short tags and if you used CI's function to convert those there would most definitely be a very small overhead with doing that.

#3
[eluser]Federico Baña[/eluser]
I'd go for <?php full tags too. Not all server settings support short tags.

#4
[eluser]InsiteFX[/eluser]
PHP 6 will drop support for short open tags!

Get use to using <?php ?>

InsiteFX

#5
[eluser]Rick Jolly[/eluser]
[quote author="InsiteFX" date="1293180644"]PHP 6 will drop support for short open tags!

Get use to using <?php ?>

InsiteFX[/quote]

Incorrect.

#6
[eluser]InsiteFX[/eluser]
Ok! I stand corrected!

From PHP.NET

The issue: PHP allows several open tags beside "<?php".
Code:
<?
    echo "Hello world";
?>
// Or, even worse.
<?="Hello world"; ?>

// Or worst:
<% echo "Hello world"; %>
&lt;? on its own is reserved for XML declaration
&lt;?= is complete invalid XML
<% is ASP style and sucks

All styles beside the official &lt;?php ... ?&gt; are deprecated.

The solution: Stick to standard tags and convert all your scripts!
Guaranteed to be supported further Represents a valid XML processing instruction
Unique in all PHP documents.

InsiteFX

#7
[eluser]Madmartigan1[/eluser]
afaik, the only real downside to short tags has something to do with having them possibly be parsed as XML tags. This is just what I heard, I don;t truly understand it.

Rasmus loves short tags, they will be in php6

I always use full tags too, but don't truly understand why. Short tags are much easier to type and especially to read (in view files).

Seriously, what's the big deal about short tags??

EDIT: Missed above post %-P

Thanks for the clarification InsiteFX

#8
[eluser]Rick Jolly[/eluser]
[quote author="InsiteFX" date="1293314534"]
All styles beside the official &lt;?php ... ?&gt; are deprecated.
[/quote]
Again, incorrect no matter what font colour you choose.

They are not depreciated latest available version of 5.3, and last I read short tags will not be depreciated for php 6.

#9
[eluser]Atharva[/eluser]
Well, it seems from some latest posts that they are not being deprecated which is a good news!

#10
[eluser]cahva[/eluser]
Yeah, they were meaning to deprecate short tags at one time and there was quite a debate about that. Conclusion was that theres no reason to deprecate or remove support for short tags. The ONLY thing why they were deprecating it was that it clashes with the xml tag "&lt;?xml" and can cause trouble then(and which is easy to correct). Other than that, theres no downside using short tags and I personally use it in views(I still use the long version everywhere else) as it's prettier for my sensible coder eyes(and designers like it too).


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.