Logo

Programming-Idioms

History of Idiom 2 > diff from v74 to v75

Edit summary for version 75 by Sting:
[PHP] PHP_EOL accounts for different line endings on different platforms

Version 74

2019-09-26, 16:48:02

Version 75

2019-09-26, 16:48:22

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\n";
Code
for($i=0;$i<10;$i++)
  echo "Hello" . PHP_EOL;
Comments bubble
Note the necessary newline (\n), 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