Hey there anyone who can point me the difference between <?= and <?php i know both are same and work normally on web servers but when recently i had installed xampp <?= showed me loads of errors can anyone tell the difference/ google showed nothing for just "<?=" lol
you can use <? rather then <?php when your server have short tag enabled (short_open_tag) inside php.ini its shorter to type <?=$test;?> then <?php echo $test;?> <?= means <? echo
<?= is the short tag for to print the variable. just like echo. But its deprecated in newer version of PHP, so its not recommended to use. instead keep habit of using echo. Best of luck...
I prefer using <?php to short tags, although there is no difference, I just think it's poor practise.
Many hosts disable short-tags in their servers, so code that's working on your local server might generate errors on these servers. So its always better to avoid using short tags.
I will tell you why the newer PHP versions adopted <?php instead of <? PHP began with <? at the start (back in version 3) which was fine at that time... but a new technology/format appeared at a later time.. called XML which guess what had the opening tag like this: <?xml Now.. at some point opening a xml file crashed the PHP script because of that <? so practically a xml file was interpreted as a PHP file => hence PHP decided to go with long tags to avoid any conflict with XML files. I hope this one helps