473,473 Members | 1,918 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

<? vs <?PHP

I often see the former starting delimiter rather than the latter. Is there
some rule about where the former can be used?
Apr 16 '06 #1
5 1269
On Mon, 2006-04-17 at 00:13 +0100, Paul Lautman wrote:
I often see the former starting delimiter rather than the latter. Is there
some rule about where the former can be used?


There is a setting in your php.ini file called short_open_tags. If it
is enabled, you can use <? instead of <?php. However, because xml also
uses the short tag <?, and for compatibility with different servers, it
is generally recommended that you use the longer <?php tag.

http://www.php.net/manual/en/ini.cor...short-open-tag

Scott

Apr 17 '06 #2
On Mon, 17 Apr 2006 00:13:32 +0100, Paul Lautman wrote:
I often see the former starting delimiter rather than the latter. Is there
some rule about where the former can be used?


<? is a shortened version of <?php for programmers too lazy to type <?php.
As <? is configurable in the php.ini file and can be turned off, so it's
availablity on any given web server is not guarentied. So use it at your
peril.
Apr 17 '06 #3
Paul Lautman wrote:
I often see the former starting delimiter rather than the latter. Is
there some rule about where the former can be used?


Thanks CJ & Scott
Apr 17 '06 #4
On Mon, 17 Apr 2006 00:13:32 +0100, Paul Lautman wrote:
I often see the former starting delimiter rather than the latter. Is there
some rule about where the former can be used?


While I agree with CJ and Scott, there is a useful construct that can be
used with short tags (<?) and if your code is running on a server you
control (as can be the case for a lot of web developers, run clients code
on servers you control) it can make for easier to read code:

<?=$foo?>

is equivalent to:

<?php echo $foo ?>

Anyway, just thought I'd add that in.

Cheers,
Andy

--
Andy Jeffries MBCS CITP ZCE | gPHPEdit Lead Developer
http://www.gphpedit.org | PHP editor for Gnome 2
http://www.andyjeffries.co.uk | Personal site and photos

Apr 17 '06 #5
I have heard also that in PHP version 6 the <? will no longer be
listened for. Which disappoints me becuase I used to always use
<?=$var?> because it's nice shorthand for the alternative.

Apr 18 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Christian Schmidbauer | last post by:
Hello! I prepare my XML document like this way: ------------------------------------------------------- PrintWriter writer; Document domDocument; Element domElement; // Root tag
4
by: matatu | last post by:
Hi to all, I have a xml file, a substring like: &lt;a href=&quot;#&quot;&gt;text&lt;/a&gt; which after an xslt trasform is rendered as (using xsl:output method html): &lt;a...
2
by: Eshrath | last post by:
Hi, What I am trying to do: ======================= I need to form a table in html using the xsl but the table that is formed is quite long and cannot be viewed in our application. So we are...
2
by: Donald Firesmith | last post by:
I am having trouble having Google Adsense code stored in XSL converted properly into HTML. The <> unfortunately become &lt; and &gt; and then no longer work. XSL code is: <script...
4
by: higabe | last post by:
Three questions 1) I have a string function that works perfectly but according to W3C.org web site is syntactically flawed because it contains the characters </ in sequence. So how am I...
34
by: Mark Moore | last post by:
It looks like there's a pretty serious CSS bug in IE6 (v6.0.2800.1106). The HTML below is validated STRICT HTML 4.01 and renders as I would expect in Opera, FrontPage, and Netscape. For some...
11
by: Les Paul | last post by:
I'm trying to design an HTML page that can edit itself. In essence, it's just like a Wiki page, but my own very simple version. It's a page full of plain old HTML content, and then at the bottom,...
10
by: Jon Noring | last post by:
Out of curiosity, may a CDATA section appear within an attribute value with datatype CDATA? And if so, how about other attribute value datatypes which accept the XML markup characters? To me,...
9
by: Eric Lindsay | last post by:
I can't figure how to best display little snippets of shell script using <pre>. I just got around to organising to bulk validate some of my web pages, and one of the problems occurs with Bash...
6
by: tentstitcher | last post by:
Hi all: I have a source xml document with an element of type string. This element contains something like the following: <stringData> &lt;Header&gt; &lt;Body&gt; </stringData> I would like to apply an...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.