RE: [PHP] weird behaviour with (Z = Z)
Perhaps not a great answer, but this issue has been brought up before, and it has to do with the incrementing of a string...search the archives...i think someone had a simple workaround using chr() to get what you want... jack -Original Message- From: Christian Dechery [mailto:[EMAIL PROTECTED]] Sent: Tuesday, July 10, 2001 11:45 AM To: [EMAIL PROTECTED] Subject: [PHP] weird behaviour with (Z = Z) Z = Z is true right?? then why this weird thing happens when I have this code: for($letter=A; $letter=Z ; $letter+) echo $letter; it should output A B C D E . W X Y Z right? but it outputs A B C D E ... W X Y Z AA AB ... YW YX YY YZ. why? . [ Christian Dechery ] . Webdeveloper @ Tá Na Mesa! . Listmaster @ Gaita-L . http://www.tanamesa.com.br -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] weird behaviour with (Z = Z)
Hello Christian, 10 July, 2001, 18:44:53, you wrote: CD Z = Z is true right?? Yes, right, but Z = Z and your code makes next iteration, then $letter = AZ and AZ is LESS that Z, because A Z. :) CD then why this weird thing happens when I have this code: CD for($letter=A; $letter=Z ; $letter+) CD echo $letter; CD it should output A B C D E . W X Y Z right? CD but it outputs A B C D E ... W X Y Z AA AB ... YW YX YY YZ. CD why? -- Best regards, Vitalimailto:[EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] weird behaviour with (Z = Z)
what??? are you sure it does that to you? You sound so confident that it confuses my knowledge that for loop should be counting integers, not strings (Z is a string and there's nothing bigger or lower it) -maxim maletsky -Original Message- From: Christian Dechery [mailto:[EMAIL PROTECTED]] Sent: Wednesday, July 11, 2001 12:45 AM To: [EMAIL PROTECTED] Subject: [PHP] weird behaviour with (Z = Z) Z = Z is true right?? then why this weird thing happens when I have this code: for($letter=A; $letter=Z ; $letter+) echo $letter; it should output A B C D E . W X Y Z right? but it outputs A B C D E ... W X Y Z AA AB ... YW YX YY YZ. why? . [ Christian Dechery ] . Webdeveloper @ Tá Na Mesa! . Listmaster @ Gaita-L . http://www.tanamesa.com.br -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] weird behaviour with (Z = Z)
Try this: ? for($i=65;$i=90;$i++){ $str .= chr($i) . ; } echo $str; ? jack -Original Message- From: Maxim Maletsky [mailto:[EMAIL PROTECTED]] Sent: Tuesday, July 10, 2001 12:10 PM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: RE: [PHP] weird behaviour with (Z = Z) what??? are you sure it does that to you? You sound so confident that it confuses my knowledge that for loop should be counting integers, not strings (Z is a string and there's nothing bigger or lower it) -maxim maletsky -Original Message- From: Christian Dechery [mailto:[EMAIL PROTECTED]] Sent: Wednesday, July 11, 2001 12:45 AM To: [EMAIL PROTECTED] Subject: [PHP] weird behaviour with (Z = Z) Z = Z is true right?? then why this weird thing happens when I have this code: for($letter=A; $letter=Z ; $letter+) echo $letter; it should output A B C D E . W X Y Z right? but it outputs A B C D E ... W X Y Z AA AB ... YW YX YY YZ. why? . [ Christian Dechery ] . Webdeveloper @ Tá Na Mesa! . Listmaster @ Gaita-L . http://www.tanamesa.com.br -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] weird behaviour with (Z = Z)
I would rather go for the following solution: for($i=ord('A'); $i=ord('Z'); $i++) echo chr($i).' '; I know it's same and even slower as it takes two more functions to execute, but at least it is visually closer to what Christian was trying to do. Sincerely, Maxim Maletsky Founder, Chief Developer PHPBeginner.com (Where PHP Begins) [EMAIL PROTECTED] www.phpbeginner.com -Original Message- From: Jack Dempsey [mailto:[EMAIL PROTECTED]] Sent: Wednesday, July 11, 2001 1:13 AM To: 'Maxim Maletsky'; [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: RE: [PHP] weird behaviour with (Z = Z) Try this: ? for($i=65;$i=90;$i++){ $str .= chr($i) . ; } echo $str; ? jack -Original Message- From: Maxim Maletsky [mailto:[EMAIL PROTECTED]] Sent: Tuesday, July 10, 2001 12:10 PM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: RE: [PHP] weird behaviour with (Z = Z) what??? are you sure it does that to you? You sound so confident that it confuses my knowledge that for loop should be counting integers, not strings (Z is a string and there's nothing bigger or lower it) -maxim maletsky -Original Message- From: Christian Dechery [mailto:[EMAIL PROTECTED]] Sent: Wednesday, July 11, 2001 12:45 AM To: [EMAIL PROTECTED] Subject: [PHP] weird behaviour with (Z = Z) Z = Z is true right?? then why this weird thing happens when I have this code: for($letter=A; $letter=Z ; $letter+) echo $letter; it should output A B C D E . W X Y Z right? but it outputs A B C D E ... W X Y Z AA AB ... YW YX YY YZ. why? . [ Christian Dechery ] . Webdeveloper @ Tá Na Mesa! . Listmaster @ Gaita-L . http://www.tanamesa.com.br -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] weird behaviour with (Z = Z)
I forget which version of PHP allows you to do the following, it may be 4.0.6 or maybe 4.0.7 : for ($a='a'; $a='z'; $a++) { print $a; } The way I get around this is by : $letter = 'a'; for ($a=1; $a=26; $a++) { print $letter++; } It works or at least may easily work for your given situation. And on a related note, in 4.0.7 the range() function will allow for : $letters = range('a','z'); As currently it just allows for integers. Regards, Philip On Wed, 11 Jul 2001, Maxim Maletsky wrote: I would rather go for the following solution: for($i=ord('A'); $i=ord('Z'); $i++) echo chr($i).' '; I know it's same and even slower as it takes two more functions to execute, but at least it is visually closer to what Christian was trying to do. Sincerely, Maxim Maletsky Founder, Chief Developer PHPBeginner.com (Where PHP Begins) [EMAIL PROTECTED] www.phpbeginner.com -Original Message- From: Jack Dempsey [mailto:[EMAIL PROTECTED]] Sent: Wednesday, July 11, 2001 1:13 AM To: 'Maxim Maletsky'; [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: RE: [PHP] weird behaviour with (Z = Z) Try this: ? for($i=65;$i=90;$i++){ $str .= chr($i) . ; } echo $str; ? jack -Original Message- From: Maxim Maletsky [mailto:[EMAIL PROTECTED]] Sent: Tuesday, July 10, 2001 12:10 PM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: RE: [PHP] weird behaviour with (Z = Z) what??? are you sure it does that to you? You sound so confident that it confuses my knowledge that for loop should be counting integers, not strings (Z is a string and there's nothing bigger or lower it) -maxim maletsky -Original Message- From: Christian Dechery [mailto:[EMAIL PROTECTED]] Sent: Wednesday, July 11, 2001 12:45 AM To: [EMAIL PROTECTED] Subject: [PHP] weird behaviour with (Z = Z) Z = Z is true right?? then why this weird thing happens when I have this code: for($letter=A; $letter=Z ; $letter+) echo $letter; it should output A B C D E . W X Y Z right? but it outputs A B C D E ... W X Y Z AA AB ... YW YX YY YZ. why? . [ Christian Dechery ] . Webdeveloper @ Tá Na Mesa! . Listmaster @ Gaita-L . http://www.tanamesa.com.br -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] weird behaviour with (Z = Z)
wow, I have just upgraded a couple of servers to v.4.0.6. Will go wild testing this staff tomorrow. Thanks Philip. Sincerely, Maxim Maletsky Founder, Chief Developer PHPBeginner.com (Where PHP Begins) [EMAIL PROTECTED] www.phpbeginner.com -Original Message- From: Philip Olson [mailto:[EMAIL PROTECTED]] Sent: Wednesday, July 11, 2001 1:45 AM To: Maxim Maletsky Cc: Jack Dempsey; [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: RE: [PHP] weird behaviour with (Z = Z) I forget which version of PHP allows you to do the following, it may be 4.0.6 or maybe 4.0.7 : for ($a='a'; $a='z'; $a++) { print $a; } The way I get around this is by : $letter = 'a'; for ($a=1; $a=26; $a++) { print $letter++; } It works or at least may easily work for your given situation. And on a related note, in 4.0.7 the range() function will allow for : $letters = range('a','z'); As currently it just allows for integers. Regards, Philip On Wed, 11 Jul 2001, Maxim Maletsky wrote: I would rather go for the following solution: for($i=ord('A'); $i=ord('Z'); $i++) echo chr($i).' '; I know it's same and even slower as it takes two more functions to execute, but at least it is visually closer to what Christian was trying to do. Sincerely, Maxim Maletsky Founder, Chief Developer PHPBeginner.com (Where PHP Begins) [EMAIL PROTECTED] www.phpbeginner.com -Original Message- From: Jack Dempsey [mailto:[EMAIL PROTECTED]] Sent: Wednesday, July 11, 2001 1:13 AM To: 'Maxim Maletsky'; [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: RE: [PHP] weird behaviour with (Z = Z) Try this: ? for($i=65;$i=90;$i++){ $str .= chr($i) . ; } echo $str; ? jack -Original Message- From: Maxim Maletsky [mailto:[EMAIL PROTECTED]] Sent: Tuesday, July 10, 2001 12:10 PM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: RE: [PHP] weird behaviour with (Z = Z) what??? are you sure it does that to you? You sound so confident that it confuses my knowledge that for loop should be counting integers, not strings (Z is a string and there's nothing bigger or lower it) -maxim maletsky -Original Message- From: Christian Dechery [mailto:[EMAIL PROTECTED]] Sent: Wednesday, July 11, 2001 12:45 AM To: [EMAIL PROTECTED] Subject: [PHP] weird behaviour with (Z = Z) Z = Z is true right?? then why this weird thing happens when I have this code: for($letter=A; $letter=Z ; $letter+) echo $letter; it should output A B C D E . W X Y Z right? but it outputs A B C D E ... W X Y Z AA AB ... YW YX YY YZ. why? . [ Christian Dechery ] . Webdeveloper @ Tá Na Mesa! . Listmaster @ Gaita-L . http://www.tanamesa.com.br -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] weird behaviour with (Z = Z)
Yeah... I solved it using ord() in the for clause and chr() in the output... it worked just fine... thanks anyway... At 11:57 10/7/2001 -0400, Jack Dempsey wrote: Perhaps not a great answer, but this issue has been brought up before, and it has to do with the incrementing of a string...search the archives...i think someone had a simple workaround using chr() to get what you want... jack -Original Message- From: Christian Dechery [mailto:[EMAIL PROTECTED]] Sent: Tuesday, July 10, 2001 11:45 AM To: [EMAIL PROTECTED] Subject: [PHP] weird behaviour with (Z = Z) Z = Z is true right?? then why this weird thing happens when I have this code: for($letter=A; $letter=Z ; $letter+) echo $letter; it should output A B C D E . W X Y Z right? but it outputs A B C D E ... W X Y Z AA AB ... YW YX YY YZ. why? . [ Christian Dechery ] . Webdeveloper @ Tá Na Mesa! . Listmaster @ Gaita-L . http://www.tanamesa.com.br -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] . Christian Dechery (lemming) . http://www.tanamesa.com.br . Gaita-L Owner / Web Developer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] weird behaviour with (Z = Z)
well... I think u may be wrong if Z is a string and there's nothing bigger or lower than it what is the result of strcmp(Z,a)??? I guarantee you it will not be 0... At 01:09 11/7/2001 +0900, Maxim Maletsky wrote: what??? are you sure it does that to you? You sound so confident that it confuses my knowledge that for loop should be counting integers, not strings (Z is a string and there's nothing bigger or lower it) -maxim maletsky -Original Message- From: Christian Dechery [mailto:[EMAIL PROTECTED]] Sent: Wednesday, July 11, 2001 12:45 AM To: [EMAIL PROTECTED] Subject: [PHP] weird behaviour with (Z = Z) Z = Z is true right?? then why this weird thing happens when I have this code: for($letter=A; $letter=Z ; $letter+) echo $letter; it should output A B C D E . W X Y Z right? but it outputs A B C D E ... W X Y Z AA AB ... YW YX YY YZ. why? . [ Christian Dechery ] . Webdeveloper @ Tá Na Mesa! . Listmaster @ Gaita-L . http://www.tanamesa.com.br -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] . Christian Dechery (lemming) . http://www.tanamesa.com.br . Gaita-L Owner / Web Developer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] weird behaviour with (Z = Z)
that is exactly what I did... it worked perfectly... At 01:40 11/7/2001 +0900, Maxim Maletsky wrote: I would rather go for the following solution: for($i=ord('A'); $i=ord('Z'); $i++) echo chr($i).' '; I know it's same and even slower as it takes two more functions to execute, but at least it is visually closer to what Christian was trying to do. Sincerely, Maxim Maletsky Founder, Chief Developer PHPBeginner.com (Where PHP Begins) [EMAIL PROTECTED] www.phpbeginner.com -Original Message- From: Jack Dempsey [mailto:[EMAIL PROTECTED]] Sent: Wednesday, July 11, 2001 1:13 AM To: 'Maxim Maletsky'; [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: RE: [PHP] weird behaviour with (Z = Z) Try this: ? for($i=65;$i=90;$i++){ $str .= chr($i) . ; } echo $str; ? jack -Original Message- From: Maxim Maletsky [mailto:[EMAIL PROTECTED]] Sent: Tuesday, July 10, 2001 12:10 PM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: RE: [PHP] weird behaviour with (Z = Z) what??? are you sure it does that to you? You sound so confident that it confuses my knowledge that for loop should be counting integers, not strings (Z is a string and there's nothing bigger or lower it) -maxim maletsky -Original Message- From: Christian Dechery [mailto:[EMAIL PROTECTED]] Sent: Wednesday, July 11, 2001 12:45 AM To: [EMAIL PROTECTED] Subject: [PHP] weird behaviour with (Z = Z) Z = Z is true right?? then why this weird thing happens when I have this code: for($letter=A; $letter=Z ; $letter+) echo $letter; it should output A B C D E . W X Y Z right? but it outputs A B C D E ... W X Y Z AA AB ... YW YX YY YZ. why? . [ Christian Dechery ] . Webdeveloper @ Tá Na Mesa! . Listmaster @ Gaita-L . http://www.tanamesa.com.br -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] . Christian Dechery (lemming) . http://www.tanamesa.com.br . Gaita-L Owner / Web Developer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]