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

<?=$item ?> or <?php echo $item;?>

witch variant is faster ?!

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.

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

PHP 6 will drop support for short open tags!

Get use to using <?php ?>


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

Get use to using <?php ?>



Ok! I stand corrected!


The issue: PHP allows several open tags beside "<?php".
    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.


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

[eluser]Rick Jolly[/eluser]
[quote author="InsiteFX" date="1293314534"]
All styles beside the official &lt;?php ... ?&gt; are deprecated.
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.

Well, it seems from some latest posts that they are not being deprecated which is a good news!

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-2020 MyBB Group.