Logo

Programming-Idioms

History of Idiom 2 > diff from v89 to v90

Edit summary for version 90 by ancarda:
[PHP] Format code snippet to PSR-12

Version 89

2019-09-26, 21:55:50

Version 90

2019-09-26, 22:05:53

Idiom #2 Print Hello 10 times

Loop to execute some code a constant number of times

Illustration

Idiom #2 Print Hello 10 times

Loop to execute some code a constant number of times

Illustration
Code
for($i=0;$i<10;$i++)
  echo "Hello" . PHP_EOL;
Code
for ($i = 0; $i < 10; $i++) {
    echo "Hello" . PHP_EOL;
}
Comments bubble
Note the necessary newline (PHP_EOL), not to print every time on the same line
Comments bubble
Note the necessary newline (PHP_EOL), not to print every time on the same line