The backtick operator " ` " is used like an exec() or passthru() function.

But I know what you mean. For instance, try running this in a script:

$n = 1;

echo "The number is: $n++<br>";
echo "The number is: $n++<br>";
echo "The number is: $n++<br>";

PHP will not increment a variable inside of a string. However, now try this:

$n = 1;

echo "The number is: " . $n++ . "<br>";
echo "The number is: " . $n++ . "<br>";
echo "The number is: " . $n++ . "<br>";

But now try this:

$n = 1;

echo "The number is: " . ++$n . "<br>";
echo "The number is: " . ++$n . "<br>";
echo "The number is: " . ++$n . "<br>";


To do what you are wanting to do, just use the post-increment or
pre-increment operators, just like in Perl. Just be aware that PHP will not
do any mathematical functions on variables which are inside of a string.


--
Plutarck
Should be working on something...
...but forgot what it was.


""Greig, Euan"" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> 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]
>



-- 
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]

Reply via email to