How to add <?= in php.ini

Problems with the Windows version of XAMPP, questions, comments, and anything related.

How to add <?= in php.ini

Postby dimko » 19. April 2010 16:59

Hi,

Can someone tell me how can I add "<?=" in php.ini or some other file, so the server can read it as a starting of a php command, just like "<?php" is.

Thanks.
dimko
 
Posts: 3
Joined: 19. April 2010 16:50

Re: How to add <?= in php.ini

Postby Altrea » 19. April 2010 18:29

<?= is not equal with <?php.

<?= is the short open tag for <?php echo
<? is the short open Tag for <?php

You can use short open tags by activate short_open_tag in the php.ini.

But its recommend to use the full open tags, not the short ones.
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 8293
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 10 Pro x64

Re: How to add <?= in php.ini

Postby dimko » 19. April 2010 19:10

Thanks for the quick replay and the explanation. I find it out, in php.ini, you should just change "Off" in "short_open_tag = Off" to "On". Don't forget to restart Apache ;)
dimko
 
Posts: 3
Joined: 19. April 2010 16:50

Re: How to add <?= in php.ini

Postby memilanuk » 19. April 2010 21:44

This may be a silly question... but is there a (good) reason why you'd need to do this?
memilanuk
 
Posts: 31
Joined: 14. August 2009 23:19

Re: How to add <?= in php.ini

Postby WilliL » 20. April 2010 20:34

memilanuk wrote:This may be a silly question... but is there a (good) reason why you'd need to do this?

yes, in next versions of php it will give no switch "short open tag"
Willi
WilliL
 
Posts: 661
Joined: 08. January 2010 10:54
Operating System: Win7Home Prem 64 SP1

Re: How to add <?= in php.ini

Postby Nobbie » 20. April 2010 21:14

WilliL wrote:yes, in next versions of php it will give no switch "short open tag"


No, thats not true. It was supposed to be removed, but it hasn't been. Its not "deprecated" in PHP5.x
Nobbie
 
Posts: 8770
Joined: 09. March 2008 13:04

Re: How to add <?= in php.ini

Postby memilanuk » 20. April 2010 21:16

I guess thats what I'm asking... if using the short open tag is slated to be deprecated (sooner or later), why is the OP trying to specifically enable that feature, rather than working with the current (and future) accepted standard of using the full <?php tag?
memilanuk
 
Posts: 31
Joined: 14. August 2009 23:19

Re: How to add <?= in php.ini

Postby Nobbie » 20. April 2010 21:34

memilanuk wrote: why is the OP trying to specifically enable that feature, rather than working with the current (and future) accepted standard of using the full <?php tag?


Because "<?=$variable?>" is one of the most important, most elegant and basic (and oldest) features of PHP for usage of dynamic variables in HTML templates. The full TAG syntax is very ugly and cloggy: "<?php echo $variable;>"
Nobbie
 
Posts: 8770
Joined: 09. March 2008 13:04

Re: How to add <?= in php.ini

Postby dimko » 21. April 2010 00:26

memilanuk wrote:This may be a silly question... but is there a (good) reason why you'd need to do this?

Because I have same script that is coded with that kind of tags, and I don't want to search and replace it :)
dimko
 
Posts: 3
Joined: 19. April 2010 16:50

Re: How to add <?= in php.ini

Postby xandrani » 21. April 2010 13:18

memilanuk wrote:why is the OP trying to specifically enable that feature, rather than working with the current (and future) accepted standard of using the full <?php tag?


Backwards compatibility with everyone's PHP scripts surely? If someone has used <? on one system and then moves to XAMPP, then allowing short tags will make their code still work. It's a bit like web browsers... it's possible to design an ultra strict HTML engine however hardly any websites would actually display then! In theory perfection is wonderful... in practise it breaks everything ;)
xandrani
 
Posts: 4
Joined: 21. April 2010 13:04


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 69 guests