Jump to content

Rewrite Short Tags


scrubbicus

Recommended Posts

So I've seen some short hand PHP syntax before and I've tried using it on my scripts and it wouldn't work, syntax such as

 

<?=$message?>

 

I just started taking a look at Code igniter today and I realized you have to enabled it in this framework, does anyone have a tutorial on how to write a script, or if it's a system setting, do that so I can use this shorthand in my work outside of frameworks?

Link to comment
https://forums.phpfreaks.com/topic/185391-rewrite-short-tags/
Share on other sites

<?= is only 2 characters shorter than a proper full tag <?php

 

and how often are you really writing an open tag anyways that would make adding those 2 extra characters so consuming?

 

stick with full tags as cags says, and stay portable.  or we'll be seeing you soon enough asking why you're code no longer works since your host upgraded their servers.

Link to comment
https://forums.phpfreaks.com/topic/185391-rewrite-short-tags/#findComment-978742
Share on other sites

Perhaps the framework handles code differently, I don't know, I have never worked with Code Igniter.

 

<?= is only 2 characters shorter than a proper full tag <?php

 

and how often are you really writing an open tag anyways that would make adding those 2 extra characters so consuming?

 

stick with full tags as cags says, and stay portable.  or we'll be seeing you soon enough asking why you're code no longer works since your host upgraded their servers.

Actually it's not only two characters shorter. <?= $var ?> is shorthand for <?php echo $var; ?> which is more like 8 characters shorter. But the point still stands.

Link to comment
https://forums.phpfreaks.com/topic/185391-rewrite-short-tags/#findComment-978743
Share on other sites

CodeIgniter parses short tags in files and converts them to "normal" code at runtime.

 

Helpful links:

http://codeigniter.com/user_guide/general/alternative_php.html

Line 673 of http://dev.ellislab.com/svn/CodeIgniter/trunk/system/libraries/Loader.php

Link to comment
https://forums.phpfreaks.com/topic/185391-rewrite-short-tags/#findComment-978755
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.