Re: Fwd: Is it possible???
| From: | Maciek Sokolewicz | Date: | Mon, 24 Jun 2013 16:17:33 +0000 |
| Subject: | Re: Fwd: Is it possible??? | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-321476@lists.php.net to get a copy of this message | ||
On 24-6-2013 14:27, nobs@nobswolf.info 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