sofcare1 Posted June 11, 2013 Share Posted June 11, 2013 Hi,I work from two separate servers/pcs. On one, I have to start my code with '<?php', while on the other I can start with just '<?'. Why is that and how can I adjust the other server so that I don't have to write 'php' after the question mark? Thanks.Chris Quote Link to comment Share on other sites More sharing options...
boompa Posted June 11, 2013 Share Posted June 11, 2013 Relevant manual page Quote Link to comment Share on other sites More sharing options...
ignace Posted June 11, 2013 Share Posted June 11, 2013 It should be noted that <? is discouraged. Quote Link to comment Share on other sites More sharing options...
AbraCadaver Posted June 11, 2013 Share Posted June 11, 2013 (edited) It should be noted that <? is discouraged. By whom? The only issue with them at this point is portability. If you are writing code to be run on your server, in your company etc. Then the control is there. Zend as well as many other frameworks/templating schemes use short tags in MVC view code. As of 5.4 they will always be available so once that is the commonly installed version it won't be an issue. That being said, I only use them in one line PHP statements in view templates. Edited June 11, 2013 by AbraCadaver Quote Link to comment Share on other sites More sharing options...
ignace Posted June 11, 2013 Share Posted June 11, 2013 (edited) I think you mean <?= which like you say will be always available since 5.4 and are used in Zend views. <? on the other hand won't and may even disappear in the future. This directive also affected the shorthand <?= before PHP 5.4.0, which is identical to <? echo. Use of this shortcut required short_open_tag to be on. Since PHP 5.4.0, <?= is always available. http://www.php.net/manual/en/ini.core.php#ini.short-open-tag Edited June 11, 2013 by ignace Quote Link to comment Share on other sites More sharing options...
Irate Posted June 11, 2013 Share Posted June 11, 2013 Portability IS the key problem, AbraCadaver, mainly because systems that do not support shortcut tags meaning any code within such tags is directly sent to the client without any previous formating or parsing which is critical. Quote Link to comment Share on other sites More sharing options...
AbraCadaver Posted June 11, 2013 Share Posted June 11, 2013 I think you mean <?= which like you say will be always available since 5.4 and are used in Zend views. <? on the other hand won't and may even disappear in the future. http://www.php.net/manual/en/ini.core.php#ini.short-open-tag You are correct my friend. Sorry for the hasty reply. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.