Programming-Idioms

History of Idiom 2 > diff from v91 to v92

Edit summary for version 92 :
[PHP] Use single quotes for higher performance

Version 91

2019-09-27, 02:17:54

Version 92

2019-09-27, 09:46:57

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