473,799 Members | 3,224 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
16 1947
rik wrote:
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.


ASP too has short hand version <%= foo %>

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

Aug 10 '05 #11
Chuck Anderson wrote:
<snip>
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? ô¿Ô¬


Probably this might help a bit
<news:11******* *************** @z14g2000cwz.go oglegroups.com> (
http://groups.google.com/group/comp....5600a4b7b4568a )

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

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


I don't see that as the reason. It's more because having a literal XML prolog
at the start of the file gets misinterpreted as PHP.

<?xml version="1.0" ...
^^
PHP sees this as start of PHP. So you have to faff around with:

<?php print "<?xml ..."

You wouldn't run PHP source through an XML validator in the first place.

--
Andy Hassall / <an**@andyh.co. uk> / <http://www.andyh.co.uk >
<http://www.andyhsoftwa re.co.uk/space> Space: disk usage analysis tool
Aug 10 '05 #13
Andy Hassall wrote:
On 9 Aug 2005 10:34:48 -0700, "Will Woodhull" <wi**@thornheng e.org> wrote:

<?xml version="1.0" ...
^^
PHP sees this as start of PHP.

Good point.

You wouldn't run PHP source through an XML validator in the first place.

I haven't done anything with PHP and XML as yet.

It is easier to validate a complex XHTML template with embedded PHP as
a .html page-- so there are times when it makes sense to run PHP source
through a validator. I expect that when I start working with AJAX kinds
of things, passing PHP source through the XML validator will be pretty
common.

Aug 10 '05 #14
On 10 Aug 2005 15:04:38 -0700, "Will Woodhull" <wi**@thornheng e.org> wrote:
Andy Hassall wrote:
You wouldn't run PHP source through an XML validator in the first place.


I haven't done anything with PHP and XML as yet.

It is easier to validate a complex XHTML template with embedded PHP as
a .html page-- so there are times when it makes sense to run PHP source
through a validator. I expect that when I start working with AJAX kinds
of things, passing PHP source through the XML validator will be pretty
common.


Hm, I still don't see why you'd pass the SOURCE through an XML validator. You
pass the OUTPUT through a validator; sure.

Surely you're not going to get very far trying to write XML-validated PHP
source code; kinda rules out using "&&" ... unless you start jumping through
hoops with CDATA or something. Then again I don't know enough about how an XML
validator would react to the contents of a <?php ?> processing instruction.

--
Andy Hassall / <an**@andyh.co. uk> / <http://www.andyh.co.uk >
<http://www.andyhsoftwa re.co.uk/space> Space: disk usage analysis tool
Aug 10 '05 #15
Andy Hassall wrote:
On 10 Aug 2005 15:04:38 -0700, Will Woodhull wrote:
Andy Hassall wrote:
You wouldn't run PHP source through an XML validator in the first
place.
It is easier to validate a complex XHTML template with embedded PHP as
a .html page-- so there are times when it makes sense to run PHP source
through a validator.
Hm, I still don't see why you'd pass the SOURCE through an XML validator.
You pass the OUTPUT through a validator; sure.

Surely you're not going to get very far trying to write XML-validated PHP
source code; kinda rules out using "&&" ... unless you start jumping through
hoops with CDATA or something. Then again I don't know enough about how an
XML validator would react to the contents of a <?php ?> processing
instruction.


As I said earlier, I don't know about XML validation-- I'll see about
that when I get there.

With XHTML, so far my experience has been that code within the <?php
.... ?> tag is ignored by the validators. Just to be clear, I'm talking
about validating stuff like

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<title><?php echo $_SESSION[spreadsheet][title] ?></title>
<script type="text/javascript">
<!--
<?php
echo <<<EOHere
// functions providing spreadsheet capabilities and
EOHere;
// load initial spreadsheet values
echo $_SESSION[spreadsheet][javascriptVaria bles];
?>
// -->
</script>
</head>
<body onload="LoadDat aToSpreadsheet( )">
<div id="spreadsheet ">
<!-- a complicated spreadsheet-like structure
with lots of "cells" -->
</div>
<form>
<!-- front end providing spreadsheet interface -->
</form>
</body>
</html>

A template like this can be complex enough that it makes sense to
validate it independently of the stuff that the PHP script will add.

Aug 11 '05 #16
Andy Hassall wrote:
Then again I don't know enough about how an XML validator would react
to the contents of a <?php ?> processing instruction.


It wouldn't react at all, because Processing Instructions are
opaque to XML - they're passed to the application as they are.
Anything goes, up till PIClose, '?>' ('>' in HTML), whether or
not PHP would interpret that PIC as a closing PHP tag.

--
Jock
Aug 11 '05 #17

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
1353
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
12324
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
1289
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
9685
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...
1
10214
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9067
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
7561
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
6803
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();...
0
5459
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5583
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4135
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
2935
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.