Jump to content

Recommended Posts

If I understand correctly, the difference is that shorthand PHP must be enabled on the server.  If it's not working, you'll need to enable shorthand PHP.

Because shorthand PHP is not used on all servers (evidenced by your shorthand not working), it is generally best (I would guess) to use

[code]<?php ?>[/code]

to enclose your PHP code blocks.
Link to comment
https://forums.phpfreaks.com/topic/33133-short-hand-php/#findComment-154353
Share on other sites

Just curious, but is it really that hard to type three letters?

Also, IMO, shorthand never should have been invented.  It just promotes bad habits, I think...

If you KNOW for a fact that shorthand will be enabled on whatever servers, then use it if you want.

For example:  if you are the web admin, and you have shorthand enabled, then you can easily and reliably use shorthand.  If you're the web admin, after all, I doubt you're going to be migrating your website to a hosting service any time soon...unless you get fired and don't have the resources available you had before (processing power and bandwidth)...
Link to comment
https://forums.phpfreaks.com/topic/33133-short-hand-php/#findComment-154362
Share on other sites

<?php echo $variable ?>
vs
<?= $variable ?>

I only use <?= on templates so whoever is using them can read them more easily.

I believe though (big chance that this is wrong) that some standards (I dunno which) suggests all dynamic languages to be called by their opening tag (<?) followed by a 3 letter identifier (php). Please correct me if I'm wrong...
Link to comment
https://forums.phpfreaks.com/topic/33133-short-hand-php/#findComment-154365
Share on other sites

[quote author=alpine link=topic=121290.msg498474#msg498474 date=1168125368]
It was discussed wether to kill the short tags from php6, it seems however that it's desided to allow <? for now. But who knows in future releases, i would stick to <?php

http://php6dev.blogspot.com/#remove-support-for-and-script-language-php-and-add-php-var
[/quote]
Well I think shorthand is better due to the fact that most coders use it and also for code such as this.

[code]<input type="text" value="<? echo $_GET['value']; ?>">[/code]

And things like that.
Link to comment
https://forums.phpfreaks.com/topic/33133-short-hand-php/#findComment-154583
Share on other sites

as has been mentioned, short tags (and also the [url=http://uk.php.net/manual/en/control-structures.alternative-syntax.php]alternative syntax for control structures[/url]) are very useful for templates where you're using PHP as the "template engine" rather than something like smarty.

With the popularity of Rails, Smarty, etc, I personally dont think they will actually get rid of them at all, even after PHP6. Most hosts have it on by default, and new downloads/installations of PHP have it turned on by default, too. Ok, so it's not much harder to type in the 'php' bit or 'php echo', but even still - it does keep templates that extra bit tidier.
Link to comment
https://forums.phpfreaks.com/topic/33133-short-hand-php/#findComment-155071
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.