Re: Adding to a numeric variable, how?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Nov 05, 2005 at 01:23:01PM +0200, Dotan Cohen wrote:
> How can I shorten it to something like this:
> <?php
> print $number." ".$number+2."\n";
> ?>

Try:

<?php
	print $number . ' ' . ($number + 2) . "\n";
?>

I think putting the $number + 2 in brackets will cause PHP to evaluate
that part of the expression before printing it.

Paul

-- 
Rogue Tory
http://www.roguetory.org.uk

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux