monkeytooth Posted February 18, 2011 Share Posted February 18, 2011 alright I've seen and use <?php <? but never before do I recall seeing <?= Nor do I even know where to look that up, so.. anyone ever see that used before, if so, any insight as to why someone would choose that? Quote Link to comment https://forums.phpfreaks.com/topic/228138-php-tags/ Share on other sites More sharing options...
Pikachu2000 Posted February 18, 2011 Share Posted February 18, 2011 The second one is a 'quick echo' syntax, same as <?php echo, but don't bother with either <? or <?=, the syntax is deprecated. Quote Link to comment https://forums.phpfreaks.com/topic/228138-php-tags/#findComment-1176479 Share on other sites More sharing options...
monkeytooth Posted February 18, 2011 Author Share Posted February 18, 2011 <?php is the only syntax i use. Right now as of very recently I picked up a project that is almost done but not quite, coder bailed, so while I am going through tryin to figure out his logic, I start coming across tags <?= like that, I never seen that tag before so I was wondering what it was. as for <? I try to avoid using it like that as I know if the server isnt configured right it wont recognize it. or on a flip not some host providers completely null that out as it conflicts some places.. But hearing about <? and <?= being depreciated.. makes me want to stay away from it more lol, but now im looking at it and sitting here stupid cause i gotta fix all that lol Quote Link to comment https://forums.phpfreaks.com/topic/228138-php-tags/#findComment-1176489 Share on other sites More sharing options...
ManiacDan Posted February 18, 2011 Share Posted February 18, 2011 but now im looking at it and sitting here stupid cause i gotta fix all thatif you only use <?php, there should be nothing to fix, right? -Dan Quote Link to comment https://forums.phpfreaks.com/topic/228138-php-tags/#findComment-1176490 Share on other sites More sharing options...
PFMaBiSmAd Posted February 18, 2011 Share Posted February 18, 2011 Simply do a global search/replace through all the files in the project (using Notepad++ for example) - 1) Change all <? to <?php 2) Change all <?phpphp to <?php 3) Change all <?php= to <?php echo Quote Link to comment https://forums.phpfreaks.com/topic/228138-php-tags/#findComment-1176491 Share on other sites More sharing options...
Pikachu2000 Posted February 18, 2011 Share Posted February 18, 2011 EDIT: I see I was beaten to the submit button . . . ^ ^ ^ It's easy to search and replace those in an editor. 1) replace '<?=' with '<? echo ' 2) replace '<?' with '<?php' 3) replace '<?phpphp' with '<?php' (just in case there were already proper <?php tags already in the code.) Quote Link to comment https://forums.phpfreaks.com/topic/228138-php-tags/#findComment-1176492 Share on other sites More sharing options...
monkeytooth Posted February 18, 2011 Author Share Posted February 18, 2011 no, they used <?= so that I have to fix throughout, as this software is developed with the intention of multiple systems not just the one its being built on. You wouldnt happen to know which version of PHP <?= and or <? was depreciated in would you? or what version it gets written completely out of.. Quote Link to comment https://forums.phpfreaks.com/topic/228138-php-tags/#findComment-1176493 Share on other sites More sharing options...
monkeytooth Posted February 18, 2011 Author Share Posted February 18, 2011 Its all good though, I really appreciate the quick answers from everyone. Yea the text editor bit or a grep search in general will take care of it all. But again I just wanted to ensure there wasn't some unknown logic to those tags being used as In my years I never seen them. Always <?php at worst <? only Quote Link to comment https://forums.phpfreaks.com/topic/228138-php-tags/#findComment-1176495 Share on other sites More sharing options...
BlueSkyIS Posted February 18, 2011 Share Posted February 18, 2011 deprecated - In computer software or authoring programs standards and documentation, the term deprecation is applied to software features that are superseded and should be avoided. depreciated - refers to two very different but related concepts: 1. decline in value of assets, and 2. allocation of the cost of assets to periods in which the assets are used. Quote Link to comment https://forums.phpfreaks.com/topic/228138-php-tags/#findComment-1176498 Share on other sites More sharing options...
ManiacDan Posted February 22, 2011 Share Posted February 22, 2011 3) Change all <?php= to <?php echoNote that this won't work. Proper syntax: <?=$var?> <?php echo $var; ?> Note the semicolon. Also, BlueSkyIS is spot-on about deprecation. It means "still works but don't write NEW code with it," not "doesn't work." -Dan Quote Link to comment https://forums.phpfreaks.com/topic/228138-php-tags/#findComment-1178186 Share on other sites More sharing options...
PFMaBiSmAd Posted February 22, 2011 Share Posted February 22, 2011 ^^^ I have no idea what you mean in your post above, but if you read the whole thread and perform the suggested search/replace in the 1,2,3 sequence that was listed, <?= will become <?php= in step 1 and <?php= will become <?php echo in step 3. Quote Link to comment https://forums.phpfreaks.com/topic/228138-php-tags/#findComment-1178190 Share on other sites More sharing options...
Pikachu2000 Posted February 22, 2011 Share Posted February 22, 2011 Actually it works just fine without the semicolon and produces no errors or warnings. Quote Link to comment https://forums.phpfreaks.com/topic/228138-php-tags/#findComment-1178192 Share on other sites More sharing options...
ManiacDan Posted February 22, 2011 Share Posted February 22, 2011 Actually it works just fine without the semicolon and produces no errors or warnings.I stand corrected. A semicolon is unnecessary in this syntax: <?php echo "hello" ?> World! <?php echo " and now goodbye" ?> Quote Link to comment https://forums.phpfreaks.com/topic/228138-php-tags/#findComment-1178229 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.