<?=$Variable?> and <? ?>

SpaceshipSpaceship
SpaceshipSpaceship
Namecheap AuctionsNamecheap Auctions
Watch

hanz

onArcade.comVIP Member
Impact
9
I just installed WAMP5 on my computer and I tested some scripts that I have made, but there seems to be some problems with using
PHP:
<?=$variable?>
and
PHP:
<? ?>
I must use
PHP:
<?php ?>
Or it just won't work.
So I was wondering if this is some kind of 'problem' with Windows, WAMP5, PHP 5 or something else. :| And should I stop using <?=$variable?> and <? ?>?

Thanks!
 
0
Close
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
In php.ini make sure, short_open_tag is set to On. And as far as if you should use it or not:

php.ini said:
; Allow the <? tag. Otherwise, only <?php and <script> tags are recognized.
; NOTE: Using short tags should be avoided when developing applications or
; libraries that are meant for redistribution, or deployment on PHP
; servers which are not under your control, because short tags may not
; be supported on the target server. For portable, redistributable code,
; be sure not to use short tags.
 
1
Close
if you are asking if you should use <? or <?php , I think it depends on how php is setup.
 
0
Close
Thanks! I guess I will have to start using <?php :D
 
0
Close
Using <?php ?> and <? echo $var ?> will make sure that your script works and your code will be nicer too ;)
 
0
Close
mch said:
Using <?php ?> and <? echo $var ?> will make sure that your script works and your code will be nicer too ;)
well, I think that <?=$variable?> looks better than <?php echo $variable; ?>, but if there may be problems with some servers then I will just have to start using <?php echo $variable; ?>
 
0
Close
DomainEasy: flexible LTO options. Close more domain deals with financing.

We're social

Escrow.com
Spaceship
Domain Recover
CryptoExchange.com

NamePros updates

Filters for activity feeds
Your news feed, Latest activity, and the activity tab on profiles now have filter buttons: All, Posts, Quick replies, and Other. Your...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back