Jump to content

Recommended Posts

I saw that <?=$var?> instead of <?php echo $var; ?> can be used for echo, does it work on every server?

the best practice is to always use full php tags in your code.

Some, or maybe most servers do not have this setting enabled. what if you were to migrate your code to a server that had short tags disabled and access to the php.ini was prohibited?

Link to comment
https://forums.phpfreaks.com/topic/254101--/#findComment-1302715
Share on other sites

No it does not work on every server. You can configure it to be enabled or disabled, excepting php5.4 where it is now enabled by default and unable to be disabled.

 

Anecdote:

We had a candidate for a job interview and as part of the reviewing process we had him write some PHP code. This guy had 10+ years of prof. experience with PHP but always started his code with <?.

 

As he tried to run his code he noticed nothing appeared... Compelely baffled, he calls the interviewer and tells him the server is broken since he can see his PHP code when he opens the browser's view source window...

 

 

We didn't hire him but I'm pretty sure that guy will start all his files now with <?php

Link to comment
https://forums.phpfreaks.com/topic/254101--/#findComment-1302798
Share on other sites

No it does not work on every server. You can configure it to be enabled or disabled, excepting php5.4 where it is now enabled by default and unable to be disabled.

 

Anecdote:

We had a candidate for a job interview and as part of the reviewing process we had him write some PHP code. This guy had 10+ years of prof. experience with PHP but always started his code with <?.

 

As he tried to run his code he noticed nothing appeared... Compelely baffled, he calls the interviewer and tells him the server is broken since he can see his PHP code when he opens the browser's view source window...

 

 

We didn't hire him but I'm pretty sure that guy will start all his files now with <?php

Heh, smarts

Link to comment
https://forums.phpfreaks.com/topic/254101--/#findComment-1302832
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.