Skip to main content
added 94 characters in body
Source Link
Kaddath
  • 2.9k
  • 5
  • 9

PHP, 22 2121 17 bytes

for(;;;;a)echo sleep(1); 

Try it online!Try it online!

I think the naive approach will be the shortest here. On TIO the output will be visible only when stopping the program of course

EDIT: saved 1 byte by echoing the falsey result of sleep, it works because sleep returns zero instead of false which would have lead to an empty string

EDIT 2: stole the suggestion from this JS answer by triggering a warning instead of an echo

PHP, 22 21 bytes

for(;;)echo sleep(1); 

Try it online!

I think the naive approach will be the shortest here. On TIO the output will be visible only when stopping the program of course

EDIT: saved 1 byte by echoing the falsey result of sleep, it works because sleep returns zero instead of false which would have lead to an empty string

PHP, 22 21 17 bytes

for(;;a)sleep(1); 

Try it online!

I think the naive approach will be the shortest here. On TIO the output will be visible only when stopping the program of course

EDIT: saved 1 byte by echoing the falsey result of sleep, it works because sleep returns zero instead of false which would have lead to an empty string

EDIT 2: stole the suggestion from this JS answer by triggering a warning instead of an echo

added 174 characters in body
Source Link
Kaddath
  • 2.9k
  • 5
  • 9

PHP, 2222 21 bytes

for(;;sleep(1);;)echo 1;sleep(1); 

Try it online!Try it online!

I think the naive approach will be the shortest here. On TIO the output will be visible only when stopping the program of course

EDIT: saved 1 byte by echoing the falsey result of sleep, it works because sleep returns zero instead of false which would have lead to an empty string

PHP, 22 bytes

for(;;sleep(1))echo 1; 

Try it online!

I think the naive approach will be the shortest here. On TIO the output will be visible only when stopping the program of course

PHP, 22 21 bytes

for(;;)echo sleep(1); 

Try it online!

I think the naive approach will be the shortest here. On TIO the output will be visible only when stopping the program of course

EDIT: saved 1 byte by echoing the falsey result of sleep, it works because sleep returns zero instead of false which would have lead to an empty string

Source Link
Kaddath
  • 2.9k
  • 5
  • 9

PHP, 22 bytes

for(;;sleep(1))echo 1; 

Try it online!

I think the naive approach will be the shortest here. On TIO the output will be visible only when stopping the program of course