On 24-6-2013 14:27, nobs@xxxxxxxxxxxxx wrote:
You should give a complete programm so we can run exactly
the same you do, like this:
<?php
$item_amount_in_store = 223;
print ("$item_amount_in_store");
Please please please please don't do this!
First of all, I don't know why you would use the print *function* when
you can also use the echo language construct (better and faster). But
that's not that important; it's not bad to use it, just imo a bit ugly
(pet peeve ;)).
But more importantly:
"$variable" is completely and utterly useless. You're basically creating
a string, interpolating a variable in it, and adding no more content.
This is effectively the same as saying:
print("".$var."")
Does that look right to you? To me it looks... wrong...
Why not just a simple:
echo $var;
or
print($var) if you really must.
And if you really really must cast the variable to a string, you can
always use the explicit:
(string) $var
$update_amount = 7;
$item_amount_in_store += $update_amount;
print (" + $update_amount = $item_amount_in_store ");
?>
which gives this result:
223 + 7 = 230
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php