0

What if i need to add it to button?

<?php $i = 1; While ($i < 100) { echo " The value is $i <br/>"; $i++; } /*What if I need to add a button and when the button is clicked i need this Loop to Stop Should i write if the button is onclicked in javascript tag $i = false; Is that right? */ ?>

13th Sep 2018, 6:59 PM
Hype Glitcher
Hype Glitcher - avatar
19 Réponses
+ 1
So What The code will be like
18th Sep 2018, 10:05 AM
Hype Glitcher
Hype Glitcher - avatar
+ 2
Get rid of the I++ to make it infinite.
18th Sep 2018, 10:04 AM
George Ryan
George Ryan - avatar
+ 1
No, you should write. (pseudocode) if button is clicked: break The break keyword ends a loop. Hope this helps.
15th Sep 2018, 2:26 PM
George Ryan
George Ryan - avatar
+ 1
No, your loop checks if the value is less than 100, if you set it to false it becomes a boolean, which will not work.
17th Sep 2018, 11:48 PM
George Ryan
George Ryan - avatar
+ 1
Your loop should stop on it's own eventually.
18th Sep 2018, 10:01 AM
George Ryan
George Ryan - avatar
+ 1
Well duh if you remove 100 your loop is no longer valid.
18th Sep 2018, 10:03 AM
George Ryan
George Ryan - avatar
+ 1
$i=1; while($i < 100){ echo "The value is $i <br/>" }
18th Sep 2018, 10:07 AM
George Ryan
George Ryan - avatar
+ 1
no remove I++
18th Sep 2018, 10:09 AM
George Ryan
George Ryan - avatar
+ 1
to make it infinite
18th Sep 2018, 10:09 AM
George Ryan
George Ryan - avatar
+ 1
find some sort of time.sleep method for php
25th Sep 2018, 11:10 AM
George Ryan
George Ryan - avatar
0
I didnt Understand Yet Can Ypu write The code for me?
15th Sep 2018, 3:54 PM
Hype Glitcher
Hype Glitcher - avatar
0
if (issane $The button[ ])) { $i = false; } Is that Work Too?
15th Sep 2018, 3:56 PM
Hype Glitcher
Hype Glitcher - avatar
0
Thats literally Hard How it is possible to stop this wave of words it is so laggy
18th Sep 2018, 9:58 AM
Hype Glitcher
Hype Glitcher - avatar
0
No What if i removed 100 It will not stop
18th Sep 2018, 10:02 AM
Hype Glitcher
Hype Glitcher - avatar
0
How do i need to make it Unstoppable or maybe like it is infinite
18th Sep 2018, 10:04 AM
Hype Glitcher
Hype Glitcher - avatar
0
But you said i need to remobe the 100
18th Sep 2018, 10:08 AM
Hype Glitcher
Hype Glitcher - avatar
0
But you make it until 99 (1<100)
18th Sep 2018, 10:10 AM
Hype Glitcher
Hype Glitcher - avatar
0
Thats so hard
25th Sep 2018, 11:42 AM
Hype Glitcher
Hype Glitcher - avatar
- 1
So slowly it will Loop because when i make it with i++ it goes to 100 quick
18th Sep 2018, 10:10 AM
Hype Glitcher
Hype Glitcher - avatar