[PHP] Re: Thread-Hijacking (was: Re: [PHP] Fwd: Is it possible???)
On 25 June 2013 10:02, Tamara Temple wrote: > Maciek Sokolewicz wrote: > > Please please please please don't do this! > > Please Please Please Do Not Hijack Threads. > Hijacking would be starting a completely different discussion in the same thread. This wasn't a discussion-starter, rather a warning ;) - Tul
[PHP] Thread-Hijacking (was: Re: [PHP] Fwd: Is it possible???)
Maciek Sokolewicz wrote: > Please please please please don't do this! Please Please Please Do Not Hijack Threads. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Fwd: Is it possible???
On Mon, Jun 24, 2013 at 06:17:33PM +0200, Maciek Sokolewicz wrote: > Please please please please don't do this! 1) You did not answer the question, nor giving any related information. 2) This was debug-output. I see not point in optimizing. 3) print is language construct, just as is echo 4) the argument to print is converted to string anyways, so ... 5) the quotes around a single variable allows fast adding helping text while debugging; so it was on purpose You are not the only one that has a coding style for a reason. So back to topic: I guess the case-sensitive variables were the most helpfull hint for the thread-starter? If not please send a complete example of your code. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Fwd: Is it possible???
Am 24.06.2013 18:17, schrieb Maciek Sokolewicz: On 24-6-2013 14:27, n...@nobswolf.info wrote: You should give a complete programm so we can run exactly the same you do, like this: 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 read and learn http://de2.php.net/manual/en/function.print.php print is not actually a real function (it is a language construct) -- Marco Behnke Dipl. Informatiker (FH), SAE Audio Engineer Zend Certified Engineer PHP 5.3 Tel.: 0174 / 9722336 e-Mail: ma...@behnke.biz Softwaretechnik Behnke Heinrich-Heine-Str. 7D 21218 Seevetal http://www.behnke.biz smime.p7s Description: S/MIME Kryptografische Unterschrift
Re: [PHP] Fwd: Is it possible???
Amen! Am 24.06.2013 18:17, schrieb Maciek Sokolewicz: > On 24-6-2013 14:27, n...@nobswolf.info wrote: >> You should give a complete programm so we can run exactly >> the same you do, like this: >> >> > >> $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
Re: [PHP] Fwd: Is it possible???
On 24-6-2013 14:27, n...@nobswolf.info wrote: You should give a complete programm so we can run exactly the same you do, like this: 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
Re: [PHP] Fwd: Is it possible???
variables are case-sensitive. $item_amount_in_store is different from $item_amount_in_Store 1st variable contains all lowercase characters, while the 2nd one contains "S" uppercase character. happy coding sachin On Mon, Jun 24, 2013 at 5:32 PM, Karl-Arne Gjersøyen wrote: > Error in my last post This is corrected: > > $item_amount_in_store = 223; > $update_amount = 7; > $item_amount_in_Store += $update_amount; > > It show the result = 227 and not 230. Why is this happen? > > Karl > > -- Forwarded message -- > From: Karl-Arne Gjersøyen > Date: 2013/6/24 > Subject: Is it possible??? > To: PHP Mailinglist > > > $item_amount_in_store = 223; > $update_amount = 7; > $update_item_amount_in_store += $update_amount; > $update_amoint_in_store is now 227; > > Why? That should be 230! > > Karl > > > > -- > Hjemmeside: http://www.karl-arne.name/ >
Re: [PHP] Fwd: Is it possible???
You should give a complete programm so we can run exactly the same you do, like this: which gives this result: 223 + 7 = 230 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Fwd: Is it possible???
On 24 Jun 2013, at 13:02, Karl-Arne Gjersøyen wrote: > Error in my last post This is corrected: > > $item_amount_in_store = 223; > $update_amount = 7; > $item_amount_in_Store += $update_amount; > > It show the result = 227 and not 230. Why is this happen? Something else is going on to give you 227, but variable names are case sensitive which is why you're not getting what you expect. Output: int(223) int(7) -Stuart -- Stuart Dallas 3ft9 Ltd http://3ft9.com/ > -- Forwarded message -- > From: Karl-Arne Gjersøyen > Date: 2013/6/24 > Subject: Is it possible??? > To: PHP Mailinglist > > > $item_amount_in_store = 223; > $update_amount = 7; > $update_item_amount_in_store += $update_amount; > $update_amoint_in_store is now 227; > > Why? That should be 230! > > Karl > > > > -- > Hjemmeside: http://www.karl-arne.name/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php