Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #13875 > unrolled thread
| Started by | richard <noreply@example.com> |
|---|---|
| First post | 2014-06-16 12:06 -0400 |
| Last post | 2014-06-17 15:13 +0000 |
| Articles | 15 — 12 participants |
Back to article view | Back to comp.lang.php
why is it always an endless loop? richard <noreply@example.com> - 2014-06-16 12:06 -0400
Re: why is it always an endless loop? Markus Heinz <markus.heinz@uni-dortmund.de> - 2014-06-16 18:17 +0200
Re: why is it always an endless loop? Derek Turner <frderek@cesmail.net> - 2014-06-16 16:19 +0000
Re: why is it always an endless loop? Stephan Jaschke <stephan@stj-online.de> - 2014-06-16 18:19 +0200
Re: why is it always an endless loop? Doug Miller <doug_at_milmac_dot_com@example.com> - 2014-06-16 16:35 +0000
Re: why is it always an endless loop? Denis McMahon <denismfmcmahon@gmail.com> - 2014-06-16 17:27 +0000
Re: why is it always an endless loop? "J.O. Aho" <user@example.net> - 2014-06-16 20:09 +0200
Re: why is it always an endless loop? Luuk <luuk@invalid.lan> - 2014-06-16 20:32 +0200
Re: why is it always an endless loop? Christoph Michael Becker <cmbecker69@arcor.de> - 2014-06-16 21:41 +0200
Re: why is it always an endless loop? Tim Streater <timstreater@greenbee.net> - 2014-06-16 21:45 +0100
Re: why is it always an endless loop? Denis McMahon <denismfmcmahon@gmail.com> - 2014-06-16 21:19 +0000
Re: why is it always an endless loop? Evan Platt <evan@theobvious.espphotography.com.invalid> - 2014-06-16 20:39 -0700
Re: why is it always an endless loop? Arno Welzel <usenet@arnowelzel.de> - 2014-06-17 08:20 +0200
Re: why is it always an endless loop? Arno Welzel <usenet@arnowelzel.de> - 2014-06-17 08:22 +0200
Re: why is it always an endless loop? Denis McMahon <denismfmcmahon@gmail.com> - 2014-06-17 15:13 +0000
| From | richard <noreply@example.com> |
|---|---|
| Date | 2014-06-16 12:06 -0400 |
| Subject | why is it always an endless loop? |
| Message-ID | <qw7xoz3y22k8.h8pla1goojcr$.dlg@40tude.net> |
$a="one"
$b="one"
while ($a=$b){echo "equal"; $b="two";)
This simple code causes an endless loop.
Why?
As soon as $b is changed, they are no longer equal, yet the loop continues.
This does not happen in BASIC.
If it is placement, where then should $b be placed?
[toc] | [next] | [standalone]
| From | Markus Heinz <markus.heinz@uni-dortmund.de> |
|---|---|
| Date | 2014-06-16 18:17 +0200 |
| Message-ID | <lnn5ah$mhq$1@speranza.aioe.org> |
| In reply to | #13875 |
Hello.
On 2014-06-16 18:06, richard wrote:
>
> $a="one"
> $b="one"
>
> while ($a=$b){echo "equal"; $b="two";)
>
> This simple code causes an endless loop.
> Why?
>
> As soon as $b is changed, they are no longer equal, yet the loop
continues.
> This does not happen in BASIC.
> If it is placement, where then should $b be placed?
>
You have to change the loop condition to
while ($a === $b)
Otherwise you assign the value of $b to $a if you use only one "=".
Regards
Markus
[toc] | [prev] | [next] | [standalone]
| From | Derek Turner <frderek@cesmail.net> |
|---|---|
| Date | 2014-06-16 16:19 +0000 |
| Message-ID | <c08joaFpo7lU3@mid.individual.net> |
| In reply to | #13875 |
On Mon, 16 Jun 2014 12:06:26 -0400, richard wrote: > As soon as $b is changed, they are no longer equal, yet the loop > continues. > This does not happen in BASIC. > If it is placement, where then should $b be placed? because ($a=$b) sets $b to the same as $a and returns true. That's not what you were trying to do, was it. And you have been told this a thousand times before, haven't you?. And WTF has basic, which has different syntax altogether got to do with it. HINT if you want to use PHP then write code in (correct) php syntax.
[toc] | [prev] | [next] | [standalone]
| From | Stephan Jaschke <stephan@stj-online.de> |
|---|---|
| Date | 2014-06-16 18:19 +0200 |
| Message-ID | <c08jp0Fq82cU1@mid.individual.net> |
| In reply to | #13875 |
Am 16.06.2014 18:06, schrieb richard:
>
> $a="one" $b="one"
>
> while ($a=$b){echo "equal"; $b="two";)
>
> This simple code causes an endless loop. Why?
>
> As soon as $b is changed, they are no longer equal, yet the loop
> continues. This does not happen in BASIC. If it is placement, where
> then should $b be placed?
>
= != == :-)
SCNR
[toc] | [prev] | [next] | [standalone]
| From | Doug Miller <doug_at_milmac_dot_com@example.com> |
|---|---|
| Date | 2014-06-16 16:35 +0000 |
| Message-ID | <XnsA34E8021818D9dougmilmaccom@78.46.70.116> |
| In reply to | #13875 |
richard <noreply@example.com> wrote in news:qw7xoz3y22k8.h8pla1goojcr$.dlg@
40tude.net:
>
> $a="one"
> $b="one"
>
> while ($a=$b){echo "equal"; $b="two";)
>
> This simple code causes an endless loop.
> Why?
Because you screwed up again, Richard the Stupid, and made a mistake that you have made
many times in the past -- and obviously, just as many times, failed to learn from it.
[toc] | [prev] | [next] | [standalone]
| From | Denis McMahon <denismfmcmahon@gmail.com> |
|---|---|
| Date | 2014-06-16 17:27 +0000 |
| Message-ID | <lnn9em$adk$1@dont-email.me> |
| In reply to | #13875 |
On Mon, 16 Jun 2014 12:06:26 -0400, richard wrote:
> $a="one"
> $b="one"
>
> while ($a=$b){echo "equal"; $b="two";)
>
> This simple code causes an endless loop.
> Why?
Because you keep ignoring something we tell you almost every week.
--
Denis McMahon, denismfmcmahon@gmail.com
[toc] | [prev] | [next] | [standalone]
| From | "J.O. Aho" <user@example.net> |
|---|---|
| Date | 2014-06-16 20:09 +0200 |
| Message-ID | <c08q6rFrneeU1@mid.individual.net> |
| In reply to | #13875 |
On 16/06/14 18:06, richard wrote:
>
> $a="one"
> $b="one"
>
> while ($a=$b){echo "equal"; $b="two";)
>
> This simple code causes an endless loop.
> Why?
try this one instead and you see why:
$a="one"
$b="one"
while($a=$b) {
echo "equal a='{$a}', b={$b}\n";
$b="two";
}
> As soon as $b is changed, they are no longer equal, yet the loop continues.
> This does not happen in BASIC.
For BASIC lacks == and ===
> If it is placement, where then should $b be placed?
It's your compare which is incorrect, I don't remember how many times
you have made the same mistake over and over again.
Don't complain about the answers in the thread, be happy that people
haven't added you to filters to not see your posts.
--
//Aho
[toc] | [prev] | [next] | [standalone]
| From | Luuk <luuk@invalid.lan> |
|---|---|
| Date | 2014-06-16 20:32 +0200 |
| Message-ID | <bqp37b-ihq.ln1@luuk.invalid.lan> |
| In reply to | #13875 |
On 16-6-2014 18:06, richard wrote:
>
> $a="one"
> $b="one"
>
> while ($a=$b){echo "equal"; $b="two";)
>
> This simple code causes an endless loop.
> Why?
>
> As soon as $b is changed, they are no longer equal, yet the loop continues.
> This does not happen in BASIC.
> If it is placement, where then should $b be placed?
>
Did someone already say to you that you asked this before?
[toc] | [prev] | [next] | [standalone]
| From | Christoph Michael Becker <cmbecker69@arcor.de> |
|---|---|
| Date | 2014-06-16 21:41 +0200 |
| Message-ID | <539f4864$0$6620$9b4e6d93@newsspool4.arcor-online.net> |
| In reply to | #13875 |
Am 16.06.2014 18:06, schrieb richard:
>
> $a="one"
> $b="one"
>
> while ($a=$b){echo "equal"; $b="two";)
>
> This simple code causes an endless loop.
> Why?
>
> As soon as $b is changed, they are no longer equal, yet the loop continues.
> This does not happen in BASIC.
> If it is placement, where then should $b be placed?
You may consider using a lint tool, such as
<http://www.icosaedro.it/phplint/phplint-on-line.html>. Parsing your
code with it points out 4 problems.
--
Christoph M. Becker
[toc] | [prev] | [next] | [standalone]
| From | Tim Streater <timstreater@greenbee.net> |
|---|---|
| Date | 2014-06-16 21:45 +0100 |
| Message-ID | <160620142145486227%timstreater@greenbee.net> |
| In reply to | #13875 |
In article <qw7xoz3y22k8.h8pla1goojcr$.dlg@40tude.net>, richard
<noreply@example.com> wrote:
> $a="one"
> $b="one"
>
> while ($a=$b){echo "equal"; $b="two";)
>
> This simple code causes an endless loop.
No it doesn't. This will not even execute.
Then you wonder why you get bashed all the time.
--
Anyone who slaps a 'this page is best viewed with Browser X' label on
a Web page appears to be yearning for the bad old days, before the Web,
when you had very little chance of reading a document written on another
computer, another word processor, or another network. -- Tim Berners-Lee
[toc] | [prev] | [next] | [standalone]
| From | Denis McMahon <denismfmcmahon@gmail.com> |
|---|---|
| Date | 2014-06-16 21:19 +0000 |
| Message-ID | <lnnn04$vm7$1@dont-email.me> |
| In reply to | #13890 |
On Mon, 16 Jun 2014 21:45:48 +0100, Tim Streater wrote:
> In article <qw7xoz3y22k8.h8pla1goojcr$.dlg@40tude.net>, richard
> <noreply@example.com> wrote:
>
>> $a="one"
>> $b="one"
>>
>> while ($a=$b){echo "equal"; $b="two";)
>>
>> This simple code causes an endless loop.
>
> No it doesn't. This will not even execute.
>
> Then you wonder why you get bashed all the time.
Tim is write. The code that you wrote as an example will not execute. The
code that you think that you wrote will, and as has been pointed out
several times, contains an error that you have been told about many times
before.
--
Denis McMahon, denismfmcmahon@gmail.com
[toc] | [prev] | [next] | [standalone]
| From | Evan Platt <evan@theobvious.espphotography.com.invalid> |
|---|---|
| Date | 2014-06-16 20:39 -0700 |
| Message-ID | <9rdvp95ntad5un9pi5hm9r5qdi3gj6oemt@4ax.com> |
| In reply to | #13891 |
On Mon, 16 Jun 2014 21:19:00 +0000 (UTC), Denis McMahon <denismfmcmahon@gmail.com> wrote: >Tim is write. The code that you wrote as an example will not execute. The >code that you think that you wrote will, and as has been pointed out >several times, contains an error that you have been told about many times >before. richard is obviously a troll. No one but a troll would make statements he makes, or make the same mistakes he makes over and over again. He has - in legal groups - stated someone should be charged with "deformation of character" dozens of times - maybe even more, going back 5+ years. And each time, he's laughed at. You would think you'd make that mistake ONCE. -- To reply via e-mail, remove The Obvious and .invalid from my e-mail address.
[toc] | [prev] | [next] | [standalone]
| From | Arno Welzel <usenet@arnowelzel.de> |
|---|---|
| Date | 2014-06-17 08:20 +0200 |
| Message-ID | <539FDE2B.4070200@arnowelzel.de> |
| In reply to | #13875 |
richard, 2014-06-16 18:06:
>
> $a="one"
> $b="one"
>
> while ($a=$b){echo "equal"; $b="two";)
>
> This simple code causes an endless loop.
> Why?
Because you STILL don't get the difference between the "=" operator
(assign) and "==" (compare)!
--
Arno Welzel
http://arnowelzel.de
http://de-rec-fahrrad.de
http://fahrradzukunft.de
[toc] | [prev] | [next] | [standalone]
| From | Arno Welzel <usenet@arnowelzel.de> |
|---|---|
| Date | 2014-06-17 08:22 +0200 |
| Message-ID | <539FDE9C.4020200@arnowelzel.de> |
| In reply to | #13875 |
\|||/
(o o)
,~~~ooO~~(_)~~~~~~~~~,
| Please |
| don't feed the |
| TROLL! |
'~~~~~~~~~~~~~~ooO~~~'
|__|__|
|| ||
ooO Ooo
[toc] | [prev] | [next] | [standalone]
| From | Denis McMahon <denismfmcmahon@gmail.com> |
|---|---|
| Date | 2014-06-17 15:13 +0000 |
| Message-ID | <lnplui$m25$1@dont-email.me> |
| In reply to | #13897 |
On Tue, 17 Jun 2014 08:22:20 +0200, Arno Welzel wrote: > \|||/ > (o o) > ,~~~ooO~~(_)~~~~~~~~~, > | Please | > | don't feed the | > | TROLL! | > '~~~~~~~~~~~~~~ooO~~~' > |__|__| > || || > ooO Ooo Arno, I would dearly love to place richard on ignore, as would many other people, but he has this habit of answering other people's questions, invariably incorrectly, handing out the worst advice possible from his years of accumulated ignorance, and presenting the resulting bullshit as authoritative solutions for them. Hence it is imperative that those of us who do know what we're talking about remain vigilant to ensure that the innocent newbies who do attract his attention receive an appropriate counterpoint. Unfortunately, as that means we have to read his shit, it also means we tend to respond to it. -- Denis McMahon, denismfmcmahon@gmail.com
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.php
csiph-web