[PHP]Opening tags

Junior Spellweaver
Joined
Mar 30, 2007
Messages
101
Reaction score
0
Hello,

When i created a website i always used a config for the basic site configurations like
PHP:
$site_name = "Site name";

then on the index page i did this:
PHP:
<title><?=$site_name;?></title>

This should echo $site_name

But i reinstalled my pc and downloaded Xampp again i coulnd use <? ?> and <?= anymore i had to use <?php ?>

Do i have some settings wrong or did the php devs drop <? ?> out?

EDIT!!!:::

Fixed already :) i just looked thru some topics in Coders Paradise someone had a link to w3schools and there was it:
On servers with shorthand support enabled you can start a scripting block with <? and end with ?>.

so i enabled it :lol:

thx for reading tho :P
 
Last edited:
Could you tell my why do you think shorttags sux? becouse i think <?=$hi;?> is more transparent then <?php echo $hi; ?>
 
<? is btw reserved for ASP.net (as i readed a few years ago)
 
Last edited:
Meh. I use <?=$var;?> pretty much.
And isn't ASP something like <% ?
It's actually not good practice, GM.

If you ever plan on writing code for something that might be used by anyone else. then it's well worth it to properly open the tag and echo the statement.

If you're only going to use it on your server and you don't plan on changing for any reason, then I suppose it's okay. :cool:
 
Tought this is in your php.ini in your apache and php dir.
Like
c:\xampp\php\php.ini
c:\xampp\apache\bin\php.ini

Search: short_open_tag
there must be something like his: short_open_tag = off
change off to on, and restart your apache server:)


edit: omg lol I just didn't read that you fixed this already O.o sorry.
 
i will add this in my config.php

$site_namae = 'I don't have a name';

<?php
print $site_name
?>

if you add in config.php

<?php
include"config.php";
print $site_name
?>
 
Back