473,785 Members | 2,388 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

PHP Output Help

rik
I was flicking through a PHP book (one of the teach in 24 hour ones)
and I came across something I had never seen before in PHP. It was a
method of printing out without using the print method, it was something
like :

<?= $myVar; ?>

Is this an out dated method? Is it compatible with all versions of PHP
(since implementation at least)?

Rick
www.e-connected.com
Aug 9 '05 #1
16 1946
On 9 Aug 2005 07:40:53 -0700, "rik" <ri*******@e-connected.com> wrote:
I was flicking through a PHP book (one of the teach in 24 hour ones)
and I came across something I had never seen before in PHP. It was a
method of printing out without using the print method, it was something
like :

<?= $myVar; ?>

Is this an out dated method?
Well, it's deprecated, as it requires short_open_tags to be enabled.

You might have thought that <?php=$myVar? > would be the long tags equivalent,
but it doesn't work.
Is it compatible with all versions of PHP
(since implementation at least)?


As far as I know - certainly valid a long way back.

I believe it's partly there to make ASP programmers more comfortable when
migrating since ASP has <%=variable%> .

--
Andy Hassall / <an**@andyh.co. uk> / <http://www.andyh.co.uk >
<http://www.andyhsoftwa re.co.uk/space> Space: disk usage analysis tool
Aug 9 '05 #2
It is the "shortcut syntax" for echo: see the manual at
http://us3.php.net/manual/en/function.echo.php
As others have noted, it's deprecated.

Aug 9 '05 #3
Andy Hassall wrote:
On 9 Aug 2005 07:40:53 -0700, "rik" <ri*******@e-connected.com> wrote:
I was flicking through a PHP book (one of the teach in 24 hour ones)
and I came across something I had never seen before in PHP. It was a
method of printing out without using the print method, it was something
like :

<?= $myVar; ?>

Is this an out dated method?


Well, it's deprecated, as it requires short_open_tags to be enabled.


I dont' think, it's deprecated.

--
<?php echo 'Just another PHP saint'; ?>
Email: rrjanbiah-at-Y!com Blog: http://rajeshanbiah.blogspot.com

Aug 9 '05 #4

R. Rajesh Jeba Anbiah wrote:
Andy Hassall wrote:
Well, it's deprecated, as it requires short_open_tags to be enabled.


I dont' think, it's deprecated.


Well you are right in that 'deprecated' is not used to describe short
tags in the documentation. They are instead described as something to
avoid since they will not validate in XHTML or XML and are no longer
supported in all PHP implementations . By inference, whatever value they
may have had back in the day is no longer sufficient to justify their
use in new code. This is the operative definition of 'to deprecate' (in
this context).

Since the shortcut form of "echo" requires short tags, it too is
something we should leave behind as PHP evolves.

Aug 9 '05 #5
Will Woodhull wrote:
R. Rajesh Jeba Anbiah wrote:

Andy Hassall wrote:

Well, it's deprecated, as it requires short_open_tags to be enabled.

I dont' think, it's deprecated.


Well you are right in that 'deprecated' is not used to describe short
tags in the documentation. They are instead described as something to
avoid since they will not validate in XHTML or XML and are no longer
supported in all PHP implementations . By inference, whatever value they
may have had back in the day is no longer sufficient to justify their
use in new code. This is the operative definition of 'to deprecate' (in
this context).

Since the shortcut form of "echo" requires short tags, it too is
something we should leave behind as PHP evolves.

Awwwww crap! I hate this deprecation merry-go-round.

I've got short tags all over my scripts, as I started doing so in the
beginning. It looks a lot nicer and uses a lot less characters (looks
less busy). It's embedded into my personal style now (<? ?> and <?= ?>).

I suppose a quick and easy search and replace could fix it all up if I
ever have the need.

XML? What's XML? ô¿Ô¬

I haven't even begun to explore xml. My sites are all Php, MySQL, HTML,
CSS and JavaScript (and DHTML). It looks like I'll have to delve into it
eventually.

--
*************** **************
Chuck Anderson • Boulder, CO
http://www.CycleTourist.com
Integrity is obvious.
The lack of it is common.
*************** **************
Aug 9 '05 #6
Why on earth would you want to run a PHP script through a XML
validator? If you ask me, being compliant with some standard just
because the standard is there is stupid.

Aug 10 '05 #7
On 2005-08-09 19-34-48 Will Woodhull <wi**@thornheng e.org> wrote:
They are instead described as something to
avoid since they will not validate in XHTML or XML


tbh, I don't care whether my PHP files validate against XHTML or XML as
long as their output does.

Regards,
Simon
--
Simon Stienen <http://slashlife.org/>
"What you do in this world is a matter of no consequence,
The question is, what can you make people believe that you have done."
/Sherlock Holmes in A Study in Scarlet by Sir Arthur Conan Doyle/
Aug 10 '05 #8
*** Will Woodhull wrote/escribió (9 Aug 2005 10:34:48 -0700):
Well you are right in that 'deprecated' is not used to describe short
tags in the documentation. They are instead described as something to
avoid since they will not validate in XHTML or XML


Which is obviously right: PHP is not XHTML or XML.

--
-- Álvaro G. Vicario - Burgos, Spain
-- http://bits.demogracia.com - Mi sitio sobre programación web
-- Don't e-mail me your questions, post them to the group
--
Aug 10 '05 #9
rik
I suppose the difference between ASP and PHP is that echo $var; is much
shorter than response.write var so there is less need to have a
shorthnd version of it.

Rick
www.e-connected.com

Aug 10 '05 #10

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

Similar topics

4
2709
by: Richard Tierney | last post by:
To create help output (the response to "myprog --help", for example) I currently create a big .h file, which includes a single string, such as: static char *help_text = "\ myprog: my program\n\ loads and\n\ loads of\n\ painfully manually\n\ formatted and\n\
3
1743
by: danmc91 | last post by:
Hi, I'm just getting going with xml and xslt. I'm trying to write what are essentially man pages and I need 3 output formats. 1) nroff -man format for real man pages 2) html for an online help browser 3) ascii where every line must start with a '%' character (octave
2
1352
by: Welman Jordan | last post by:
Hello, I met with a tough problem when making my pages. Please help. To make the problem short, i write down what i want here first, and then explain my situation in details. How can I acchieve this: Only one Page_Load, and then the output of the control is cached within the Cache, accessible via a programatically generated
0
1520
by: F.C. | last post by:
Hello, :) I'm currently writing a frontend for a console application using VB .net. I'm using the traditional Process creation to launch it and redirect input and output to my windows application, something like this : myProcess.StartInfo.UseShellExecute = False myProcess.StartInfo.CreateNoWindow = True myProcess.StartInfo.RedirectStandardInput = True myProcess.StartInfo.RedirectStandardOutput = True
3
1285
by: sp | last post by:
hai i have got 1. an xml file 2. an xsl file and my xsl file filters the xml based on attribute value and the output i receive is in the ordinary format
0
2066
by: newbie | last post by:
i'm a newbie of c language. can anyone help me to implement the code so that I can get the ciphertext from the output. thanks. #ifndef _3DES_H #define _3DES_H #ifndef uint8 #define uint8 unsigned char #endif
1
12323
by: John Bailo | last post by:
This is a my solution to getting an Output parameter from a SqlDataSource. I have seen a few scant articles but none of them take it all the way to a solution. Hopefully this will help some poor soul. Situation: I want to do a lookup using a stored procedure for each value in a Row within a GridView. I use a lookup function in my code behind, evaluating the necessary bound fields. The problem is the SqlDataSource representing...
1
3615
by: yohan610 | last post by:
i have to read the binary data of a file, then encrypt them according to a supplied algorithm...and then the obtained output has to be written to an output file...everything works ok, and there are no errors... but when i print out the binary data from the input file it seems to be the same whtever the file, and then after encrypting and wirting the data to the output file, the output file has a size of 0KB and nothing in it..pls help as soon...
14
12832
by: =?Utf-8?B?R2lkaQ==?= | last post by:
Hi, In my windows applicationm, i need to excute a batch file. this batch file throws some text and questions to the screen, i need to catch the standard Output, check if it's a question, in case it's a question, i want to popup a messageBox or something, and bring back to the batch file the result (Yes\No question). I know how to excute the batch file and get all the Standard output at the end, but i don't know who can i read it line by...
1
1288
by: LittlBUGer | last post by:
Hello. First of all I'm programming in VB.NET/ASP.NET doing a page for a website. Now, to my question.... I have a simple array of integer numbers (15 characters in length) which can hold up to 2000 items. What I basically need to do is output these numbers to a PDF file I'm creating on the fly and I can only fit a certain amount of numbers per page. What I need to do is just output these on each page in numerical order vertically NOT...
0
9647
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10357
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10163
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9959
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8988
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7510
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6744
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4063
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2894
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.