You are here: Re: [PHP] Adding to a numeric variable, how? « PHP « IT news, forums, messages
Re: [PHP] Adding to a numeric variable, how?

Posted by Paul Waring on 11/05/05 13:22

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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация