RE: [PHP] php equivalent for `command`
| From: | Greig, Euan | Date: | Wed, 18 Apr 2001 09:10:34 +0000 |
| Subject: | RE: [PHP] php equivalent for `command` | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-49162@lists.php.net to get a copy of this message | ||
I deliberately gave a simple example, perhaps too simple. I want to output quite long and
complicated strings that may involve evaluated variables, calls to functions etc. But I also want it
to as legible as possible. But even something simple along the lines I quoted gives me problems. See
the following code and its output
<?php
$test=1;
echo $test++ . "<BR>";
echo $test++ . "<BR>";
$test=1;
echo "Value of test: $test++ <BR>";
echo "Value of test: $test++ <BR>";
?>
The output:
1
2
Value of test: 1++
Value of test: 1++
In the second set of code lines, what I need to do is somehow bracket off the $test++ so it is
evaluated before being echoed.
Euan
-----Original Message-----
From: Jason Brooke [mailto:jason@qgl.org]
Sent: 18 April 2001 09:46
To: Greig, Euan; php-general@lists.php.net
Subject: Re: [PHP] php equivalent for
command
echo ++$x;
http://www.php.net/manual/en/language.operators.increment.php
> > Is there a php equivalent for the use of ` (I think) in Unix/Perl? So
for example echo "$x++" would first evaluate $x++ and then print the
resulting value.
> >
> > Euan Greig
> > Technical Consultant
> > BRANN DATA
> > euan.greig@brann.com
> > 01285 645997
**************************************************************************
Any opinions expressed in this email are those of the individual and
not necessarily the Company. This email and any files transmitted with
it, including replies and forwarded copies (which may contain alterations)
subsequently transmitted from the Company, are confidential and solely for
the use of the intended recipient. If you are not the intended recipient
or the person responsible for delivering to the intended recipient, be
advised that you have received this email in error and that any use is
strictly prohibited.
**************************************************************************