Skip to content

Commit 81c7c62

Browse files
committed
End of Line (#888)
End of line changed from `\n` to `PHP_EOL`
1 parent 9568720 commit 81c7c62

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

_posts/03-05-01-Command-Line-Interface.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ Let's write a simple "Hello, $name" CLI program. To try it out, create a file na
2727
{% highlight php %}
2828
<?php
2929
if ($argc !== 2) {
30-
echo "Usage: php hello.php <name>.\n";
30+
echo "Usage: php hello.php <name>" . PHP_EOL;
3131
exit(1);
3232
}
3333
$name = $argv[1];
34-
echo "Hello, $name\n";
34+
echo "Hello, $name" . PHP_EOL;
3535
{% endhighlight %}
3636

3737
PHP sets up two special variables based on the arguments your script is run with. [`$argc`][argc] is an integer

_posts/05-03-01-Date-and-Time.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ output.
1919
$raw = '22. 11. 1968';
2020
$start = DateTime::createFromFormat('d. m. Y', $raw);
2121
22-
echo 'Start date: ' . $start->format('Y-m-d') . "\n";
22+
echo 'Start date: ' . $start->format('Y-m-d') . PHP_EOL;
2323
{% endhighlight %}
2424

2525
Calculating with DateTime is possible with the DateInterval class. DateTime has methods like `add()` and `sub()` that
@@ -34,7 +34,7 @@ $end = clone $start;
3434
$end->add(new DateInterval('P1M6D'));
3535

3636
$diff = $end->diff($start);
37-
echo 'Difference: ' . $diff->format('%m month, %d days (total: %a days)') . "\n";
37+
echo 'Difference: ' . $diff->format('%m month, %d days (total: %a days)') . PHP_EOL;
3838
// Difference: 1 month, 6 days (total: 37 days)
3939
{% endhighlight %}
4040

@@ -43,8 +43,7 @@ You can use standard comparisons on DateTime objects:
4343
{% highlight php %}
4444
<?php
4545
if ($start < $end) {
46-
echo "Start is before the end!\n";
47-
}
46+
echo "Start is before the end!" . PHP_EOL;}
4847
{% endhighlight %}
4948
5049
One last example to demonstrate the DatePeriod class. It is used to iterate over recurring events. It can take two

0 commit comments

Comments
 (0)