I was hoping to avoid concatenation to make my code more legible (less illegible?).
I take it then that there is no equivalent for the use of ` in Unix.
-----Original Message-----
From: Plutarck [mailto:[EMAIL PROTECTED]]
Sent: 18 April 2001 15:13
To: [EMAIL PROTECTED]
Subject: Re: [PHP] php equivalent for `command`
> 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.
You need to use the string concantenation operator (a period) to use things
like $test++, else PHP get's confused.
> echo "Value of test: $test++ <BR>";
To get that to work like you want it to, you need only do:
echo 'Value of test: ' . $test++ . ' <BR>';
It's functionally the same, no brackets needed. If you want it to be
evaluated BEFORE it's echoed, you need to use:
echo 'Value of test: ' . ++$test . ' <BR>';
--
Plutarck
Should be working on something...
...but forgot what it was.
""Greig, Euan"" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> 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:[EMAIL PROTECTED]]
> Sent: 18 April 2001 09:46
> To: Greig, Euan; [EMAIL PROTECTED]
> 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
> > > [EMAIL PROTECTED]
> > > 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.
>
> **************************************************************************
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
**************************************************************************
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.
**************************************************************************
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]