...

View Full Version : Is it mandatory to use



Puppet Master
11-19-2010, 10:36 PM
When coding in PHP, is there a difference between the following opening tags?


<?php

echo This is a program

?>

and this one


<?

echo This is a program

?>

-PM-

mlseim
11-19-2010, 10:50 PM
It's called the "short open tag" ....

Defined in the PHP .ini file:

http://php.net/manual/en/ini.core.php

Default is that the short tag is allowed.

MattF
11-19-2010, 10:50 PM
Yes. The former type is guaranteed to work on any system whilst the latter is not.

Puppet Master
11-19-2010, 11:03 PM
Oh, okay thanks. Nice to know ;)

-PM-

Keleth
11-20-2010, 12:11 AM
If the latter works, you also have access to what is basically a short echo:


<?=$name?>

will echo the value of $name.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum