From 4f086c3acaefbf74e62357d7ed13ae373a179891 Mon Sep 17 00:00:00 2001 From: Nick Adams Date: Tue, 14 Aug 2012 23:15:25 +1200 Subject: [PATCH] Unified conditional arguments and replaced APC example --- _posts/03-05-01-Command-Line-Interface.md | 2 +- _posts/05-03-01-Date-and-Time.md | 13 ++++++------- _posts/10-03-01-Object-Caching.md | 11 ++++------- 3 files changed, 11 insertions(+), 15 deletions(-) diff --git a/_posts/03-05-01-Command-Line-Interface.md b/_posts/03-05-01-Command-Line-Interface.md index 3371823..8790591 100644 --- a/_posts/03-05-01-Command-Line-Interface.md +++ b/_posts/03-05-01-Command-Line-Interface.md @@ -22,7 +22,7 @@ Let's write a simple "Hello, $name" CLI program. To try it out, create a file na {% highlight php %} format('m/d/Y') . "\n"; +echo 'Start date: ' . $start->format('m/d/Y') . "\n"; {% endhighlight %} Calculating with DateTime is possible with the DateInterval class. DateTime has methods like `add()` and `sub()` that @@ -30,18 +30,18 @@ $end = clone $start; $end->add(new \DateInterval('P1M6D')); $diff = $end->diff($start); -echo "Difference: " . $diff->format('%m month, %d days (total: %a days)') . "\n"; +echo 'Difference: ' . $diff->format('%m month, %d days (total: %a days)') . "\n"; // Difference: 1 month, 6 days (total: 37 days) {% endhighlight %} On DateTime objects you can use standard comparison: {% highlight php %} format('m/d/Y') . " "; + echo $date->format('m/d/Y') . ' '; } {% endhighlight %} diff --git a/_posts/10-03-01-Object-Caching.md b/_posts/10-03-01-Object-Caching.md index c072aea..b296689 100644 --- a/_posts/10-03-01-Object-Caching.md +++ b/_posts/10-03-01-Object-Caching.md @@ -28,15 +28,12 @@ Example logic using APC: {% highlight php %}