UnknownPlayer Posted December 30, 2011 Share Posted December 30, 2011 I saw that <?=$var?> instead of <?php echo $var; ?> can be used for echo, does it work on every server? Link to comment https://forums.phpfreaks.com/topic/254101--/ Share on other sites More sharing options...
trq Posted December 30, 2011 Share Posted December 30, 2011 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. Link to comment https://forums.phpfreaks.com/topic/254101--/#findComment-1302706 Share on other sites More sharing options...
arbitter Posted December 30, 2011 Share Posted December 30, 2011 So this is an easy way of inserting a php var inside some html text? Good to know! Link to comment https://forums.phpfreaks.com/topic/254101--/#findComment-1302708 Share on other sites More sharing options...
AyKay47 Posted December 31, 2011 Share Posted December 31, 2011 Quote 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 More sharing options...
ignace Posted December 31, 2011 Share Posted December 31, 2011 Quote 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 More sharing options...
AyKay47 Posted December 31, 2011 Share Posted December 31, 2011 Quote Quote 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 More sharing options...
UnknownPlayer Posted January 1, 2012 Author Share Posted January 1, 2012 Thanks. Link to comment https://forums.phpfreaks.com/topic/254101--/#findComment-1303084 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.