blueman378 Posted March 19, 2008 Share Posted March 19, 2008 hi guys in terms of <?php echo $a; ?> vs <?=$a?> whats the differnce, and which is better? Quote Link to comment https://forums.phpfreaks.com/topic/96850-vs/ Share on other sites More sharing options...
Jeremysr Posted March 19, 2008 Share Posted March 19, 2008 They mean exactly the same thing, the second is just shorter, easier to type. I think I heard that the second one doesn't work on all servers, but the first one is guaranteed to work everywhere. Quote Link to comment https://forums.phpfreaks.com/topic/96850-vs/#findComment-495646 Share on other sites More sharing options...
MasterACE14 Posted March 19, 2008 Share Posted March 19, 2008 the first one is guaranteed to work everywhere. where as the shorthand way isn't enabled on all web servers... Regards ACE Quote Link to comment https://forums.phpfreaks.com/topic/96850-vs/#findComment-495647 Share on other sites More sharing options...
PFMaBiSmAd Posted March 19, 2008 Share Posted March 19, 2008 Even php.net recommends not using the <? and <?= since it results in non portable code that won't work unless the server is configured to recognize it. The <? also creates a problem with xml in a .php file because the php parser is not smart enough to know that <?xml is not a short open <? tag. And frankly, the short open tag was just a lazy way short cut that introduced two equivalent ways of doing the same thing, except one of the ways won't always work and one will always work. Quote Link to comment https://forums.phpfreaks.com/topic/96850-vs/#findComment-495657 Share on other sites More sharing options...
blueman378 Posted March 19, 2008 Author Share Posted March 19, 2008 ok thanks, quick question then, aslong as i use <?php in mosto f the php code is it alright to use <?= for small echoes in the middle of large html blocks? or should i avoid it all together? Quote Link to comment https://forums.phpfreaks.com/topic/96850-vs/#findComment-495658 Share on other sites More sharing options...
samshel Posted March 19, 2008 Share Posted March 19, 2008 avoid it altogether ! Quote Link to comment https://forums.phpfreaks.com/topic/96850-vs/#findComment-495673 Share on other sites More sharing options...
dennismonsewicz Posted March 19, 2008 Share Posted March 19, 2008 yeah, I totally agree with avoiding it all together. The server I work off us does not support <? or <?= and sometimes working with someone elses code can be a pain if that mistake is not caught cause it will cause pages to not work properly! Quote Link to comment https://forums.phpfreaks.com/topic/96850-vs/#findComment-495684 Share on other sites More sharing options...
haku Posted March 19, 2008 Share Posted March 19, 2008 Ignore it altogether. Sloppy programming. Quote Link to comment https://forums.phpfreaks.com/topic/96850-vs/#findComment-495704 Share on other sites More sharing options...
blueman378 Posted March 20, 2008 Author Share Posted March 20, 2008 ok thanks guys, one last question, whats up with the tutorials? should we not have a tutorial idea thread or something where people can submit thier tutorials and the mods can review them and if appropriate they can move them into the tutorials section because i must say at the moment the tutorial section is a bit pitiful.... Quote Link to comment https://forums.phpfreaks.com/topic/96850-vs/#findComment-496614 Share on other sites More sharing options...
wildteen88 Posted March 20, 2008 Share Posted March 20, 2008 ok thanks guys, one last question, whats up with the tutorials? should we not have a tutorial idea thread or something where people can submit thier tutorials and the mods can review them and if appropriate they can move them into the tutorials section because i must say at the moment the tutorial section is a bit pitiful.... The main site is currently going under complete reconstruction. The admins decided to import the current tutorials into the forum for now. Once the main site is relaunched all forums members will have access to publishing tutorials. Quote Link to comment https://forums.phpfreaks.com/topic/96850-vs/#findComment-496655 Share on other sites More sharing options...
haku Posted March 20, 2008 Share Posted March 20, 2008 Nice! Good luck with that I'll definitely put something up on Japanese encoding. I can link my portfolio to it too. Quote Link to comment https://forums.phpfreaks.com/topic/96850-vs/#findComment-496710 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.