Solved

CodeIgniter PHP alternative syntax

Posted on 2009-04-01
3
360 Views
Last Modified: 2012-05-06
Experts:

I'm new to CodeIgniter.  I see code like <?=$Hello_World?> replaces the echo function in a project I'm working on.  My question is,  is this syntax an extension of PHP that I can find on php.net or it's specific to CodeIgniter?  Who translates it to native PHP code before PHP process the source file?
0
Comment
Question by:LogicInnovations
  • 2
3 Comments
 
LVL 18

Accepted Solution

by:
Hube02 earned 50 total points
ID: 24045302
That is a shorthand form for <?php echo $Hello_World ?> and works the same.

It is part of PHP but I believe that it requires the setting in php.ini

short_open_tag = On

0
 

Author Closing Comment

by:LogicInnovations
ID: 31565585
Thanks!
0
 
LVL 18

Expert Comment

by:Hube02
ID: 24045473
This is not part of the answer, but my opinion, and you know what they say about opinions....

At any rate, I believe that you should avoid using short tags. They are not recommended and a php script that is written with short tags will not run on a server where they are disabled. What happens if this happens is that all of you code is output and visible to all. Not all hosts will turn short tags on.

Also, starting in PHP 6 short tags will be eliminated, or that is what I've read. So, everyone needs to get out of the habit of using short tags anyway.

Your best bet is to continue to use what you have always used <?php echo... rather than <?=...
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question