<?xml version="1.0"?>
<rss version="2.0">
  <channel>
    <title>PHPDeveloper.org</title>
    <link>http://www.phpdeveloper.org</link>
    <description>Up-to-the Minute PHP News, views and community</description>
    <language>en-us</language>
    <pubDate>Sat, 25 May 2013 00:05:22 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[Phil Sturgeon: Why PHP DateTime Rocks]]></title>
      <guid>http://www.phpdeveloper.org/news/18311</guid>
      <link>http://www.phpdeveloper.org/news/18311</link>
      <description><![CDATA[<p>
<i>Phil Sturgeon</i> has a new post sharing some of his thoughts on <a href="http://philsturgeon.co.uk/blog/2012/08/why-php-datetime-rocks">why DateTime rocks</a>, the advanced functionality that PHP has to work with dates, times, timezones, etc.
</p>
<blockquote>
DateTime is nothing new, but it's definitely under-used by many. It was made available in PHP 5.2.0 but got some of its best features until PHP 5.3.0. PHP 5.3.0 is pretty old now, but I learned about <a href="http://uk.php.net/manual/en/datetime.createfromformat.php">DateFormat::createFromFormat()</a> after reading a new addition to <a href="http://www.phptherightway.com/#date_and_time">PHP The Right Way: Date and Time</a>.
</blockquote>
<p>
He shares to "offender" examples where using this function allowed him to simplify and reduce the amount of code needed to handle the formatting of a date into a MySQL format and calculating the difference between two time values.
</p>]]></description>
      <pubDate>Thu, 02 Aug 2012 11:41:29 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Bob Majdak: Apache access logging in JSON format]]></title>
      <guid>http://www.phpdeveloper.org/news/18277</guid>
      <link>http://www.phpdeveloper.org/news/18277</link>
      <description><![CDATA[<p>
<i>Bob Majdak</i> has a quick new post to his site showing you how to <a href="http://catch404.net/2012/07/apache-access-logging-in-json-format/">log messages to Apache</a> using a JSON format instead of the usual single-line information.
</p>
<blockquote>
So this past week I have been doing a lot of logging, parsing, and graphing. I was sitting there wondering what I could do to make the Apache access logs easier to work with. Then it hit me, a brilliant stroke of win: why not format it in JSON? Then in my log parser I could just json_decode it! As far as I know there are no tricks to make Apache do this for you, so really all we have to do is define a custom log format that happens to look like JSON.
</blockquote>
<p>
He includes the "LogFormat" line you'll need to add to your Apache configuration to make it log the JSON and a bit of PHP to help you pull in the file's contents and <a href="http://php.net/json_decode">parse</a> each line.
</p>]]></description>
      <pubDate>Thu, 26 Jul 2012 11:42:02 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[PHPMaster.com: Working with Dates and Times in PHP and MySQL]]></title>
      <guid>http://www.phpdeveloper.org/news/17608</guid>
      <link>http://www.phpdeveloper.org/news/17608</link>
      <description><![CDATA[<p>
On PHPMaster.com today there's a new tutorial by <i>Sean Hudgston</i> about <a href="http://phpmaster.com/working-with-dates-and-times">working with dates and times</a> via the PHP date functions and how they cooperate with dates/times from a MySQL database.
</p>
<blockquote>
When working in any programming language, dealing with dates and time is often a trivial and simple task. That is, until time zones have to be supported. Fortunately, PHP has one of the most potent set of date/time tools that help you deal with all sorts of time-related issues: Unix timestamps, formatting dates for human consumption, displaying times with time zones, the difference between now and the second Tuesday of next month, etc. In this article I'll introduce you to the basics of PHP's time functions (time(), mktime(), and date()) and their object-oriented counterparts, and then take a look at MySQL dates and show you how to make them play nicely with PHP.
</blockquote>
<p>
His examples include how to get the current Unix time, formatting dates/times, making timestamps and working with the more powerful DateTime objects. On the MySQL front, he shows the result of a normal date select, one using the "unix_timestamp" function and how to shift the result based on the user's timezone.
</p>]]></description>
      <pubDate>Thu, 01 Mar 2012 08:51:47 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[php|architect: Seeing Triple!]]></title>
      <guid>http://www.phpdeveloper.org/news/15991</guid>
      <link>http://www.phpdeveloper.org/news/15991</link>
      <description><![CDATA[<p>
php|architect Magazine has <a href="http://www.phparch.com/2011/03/seeing-triple/">officially announced</a> the introduction of a new publishing format for their magazine. Readers are no longer tied to just PDF versions - they can now opt for ePUB editions of the magazine starting with this month's issue (and retroactively!).
</p>
<blockquote>
Still, even though PDF was a less popular format in 2002 than it has become today, it was a much easier choice for us when the only way to read an electronic publication was to sit in front of a computer. The advent of portable e-book readers demanded that we consider other formats; as a result, about six months ago we started a skunkworks program, spearheaded by our very own Keith Casey, to create ePub and MOBI versions of our magazine.
</blockquote>
<p>
Thanks to an ePUB document generator, the magazine can now be dynamically generated into three formats - the usual PDF file, an ePUB edition and a MOBI edition for the Kindle fans out there. All subscribers have been upgraded to this plan - the Premium subscription - and are able to start pulling down these editions today.
</p>]]></description>
      <pubDate>Thu, 03 Mar 2011 10:05:47 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Volker Dusch's Blog: Creating your custom PHPUnit output formats]]></title>
      <guid>http://www.phpdeveloper.org/news/15773</guid>
      <link>http://www.phpdeveloper.org/news/15773</link>
      <description><![CDATA[<p>
<i>Volker Dusch</i> has a new post to his blog today talking about PHPUnit and how you can make <a href="http://edorian.posterous.com/creating-your-custom-phpunit-output-formats">custom output formats</a> to get the results exactly how you need them. The trick is in using XSLT for transformation.
</p>
<blockquote>
While tackling with someones question i decided it's time to play around with xslt for learning purposes and i found something useful to do.
He wanted to extend the --testdox-html output and i proposed to just transform phpunits xml output using an xslt since i didn't see a easy way to prove a custom implemenation for PHPUnit/Util/TestDox/ResultPrinter/HTML.php and i didn't want to change the file its self.
</blockquote>
<p>
He gives an example of how to use the textdox output method to generate an XML document of the unit test run's results and a simple XSLT style sheet to format the results as a custom HTML page. He uses the "xsltproc" command line tool to make the translation happen.
</p>]]></description>
      <pubDate>Thu, 20 Jan 2011 08:36:00 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Rob Allen's Blog: Validating dates]]></title>
      <guid>http://www.phpdeveloper.org/news/15405</guid>
      <link>http://www.phpdeveloper.org/news/15405</link>
      <description><![CDATA[<p>
In a new Zend Framework related post to his blog today <i>Rob Allen</i> takes a look at <a href="http://akrabat.com/zend-framework/validating-dates/">a different operating mode he found with Zend_Date</a> changing how it handles format specifiers.
</p>
<blockquote>
I discovered recently that Zend Framework 1's Zend_Date has two operating modes when it comes to format specifiers: iso and php, where iso is the default. When using Zend_Validate_Date in forms, I like to use the php format specifiers as they are what I'm used to and so can easily know what they mean when reviewing code that I wrote months ago.
</blockquote>
<p>
His example code shows how you can use the standard <a href="http://php.net/date">date</a> formatting strings in a Zend_Form validator (the "php" format) and an example using the Zend_Date::MONTH or Zend_Date::YEAR identifiers (the "iso" format). He also shows how he met two other requirements - validation for empty and a consistent format on the date validation ("Y-m-d").
</p>]]></description>
      <pubDate>Tue, 09 Nov 2010 12:11:12 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Brian Swan's Blog: Rendering SQL Server Reports as Excel Documents with PHP]]></title>
      <guid>http://www.phpdeveloper.org/news/15190</guid>
      <link>http://www.phpdeveloper.org/news/15190</link>
      <description><![CDATA[<p>
<i>Brian Swan</i> has <a href="http://blogs.msdn.com/b/brian_swan/archive/2010/09/23/rendering-sql-server-reports-as-excel-documents-with-php.aspx">a new post</a> to his blog that looks at a method for pulling back the reports from a SQL Server instance in something a bit more readable/useful - an Excel document.
</p>
<blockquote>
One of the most common questions [from his <a href="http://blogs.msdn.com/b/brian_swan/archive/2010/05/04/getting-started-with-sql-server-reporting-services-ssrs-and-php.aspx">previous post</a>] has been "How do I render a report as an Excel document?" I've been telling folks that this is easy with the <a href="http://ssrsphp.codeplex.com/">SSRS SDK for PHP</a> (and it is  easy), but when I sat down to do it, I ran into a problem. So, in this post, I'll show you how to render a SSRS report as an Excel document and how to avoid the one problem that caused me headaches.
</blockquote>
<p>
This post's a short one with a code snippet (<a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Components-PostAttachments/00-10-06-27-28/ssrsDemo.zip">and download</a>) showing how to connect to the server and create a "RenderAsEXCEL" object and request the report information with that in the rendering function. Then it's just as simple as pushing that information out to a file as a ".xls". The included download will also let you pull down the report as HTML or as a PDF.
</p>]]></description>
      <pubDate>Mon, 27 Sep 2010 10:15:51 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Court Ewing's Blog: Forget Concatenation; Format your strings!]]></title>
      <guid>http://www.phpdeveloper.org/news/15138</guid>
      <link>http://www.phpdeveloper.org/news/15138</link>
      <description><![CDATA[<p>
On his blog today <i>Court Ewing</i> has <a href="http://epixa.com/2010/09/forget-concatenation-format-your-strings">posted a tutorial</a> about a different approach to merging strings while formatting them at the same time - using <a href="http://php.net/sprintf">sprintf</a> and <a href="http://php.net/printf">printf</a> for more than just a single-shot output.
</p>
<blockquote>
I do it, you do it, everyone does it! We all concatenate. If you're simply combining a few variables or constants together, concatenation is the way to go. After all, it is quick and easy, and who can complain about that? However, concatenation does have two serious drawbacks: any sort of string formatting must be done manually, and it is difficult to visualize the "goal" string when it is sufficiently complex.
</blockquote>
<p>
He talks about the benefits of string formatting over basic string concatination like how easy it makes casting variable values - multiple or single - without you having to cast them manually and append. He gives a few code examples of how it can be used for simple formatting and how it can make escaping data used in multiple spots easier. He also includes a SQL query example showing the difference between using <a href="http://php.net/sprintf">sprintf</a> and a normal concatinated statement.
</p>]]></description>
      <pubDate>Thu, 16 Sep 2010 08:38:35 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Stefan Koopmanschap's Blog: Formatting valid xs:dateTime fields with PHP]]></title>
      <guid>http://www.phpdeveloper.org/news/13190</guid>
      <link>http://www.phpdeveloper.org/news/13190</link>
      <description><![CDATA[<p>
<i>Stefan Koopmanschap</i> had a problem - the formatting on his dateTime fields (the XSD type) wasn't cooperating and couldn't be validated. He <a href="http://www.leftontheweb.com/message/Formatting_valid_xsdateTime_fields_with_PHP">asked the question</a> of the community of how to correct this and was given a short and easy answer from <i>David Zuelke</i> using <a href="http://php.net/date">date</a>.
</p>
<blockquote>
Recently I had to compose some XML documents that needed to be validated with XSDs. All fine of course, but I had some problem with two date/time fields that according to the XSD were supposed to be xs:dateTime fields. Googling around I found a lot of references to the ISO8601 format, so I decided to format my date using the DATE_ISO8601 constant. That did not work though.
</blockquote>
<p>
<i>David</i>'s suggestion was to use "date('c')" (the full ISO 8601 date) instead of the DATE_ISO8601 constant. The trouble is caused by a missing colon in the second choice's output.
</p>]]></description>
      <pubDate>Wed, 09 Sep 2009 09:19:15 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Federico Cargnelutti's Blog: Format a time interval with the requested granularity]]></title>
      <guid>http://www.phpdeveloper.org/news/12756</guid>
      <link>http://www.phpdeveloper.org/news/12756</link>
      <description><![CDATA[<p>
<i>Federico Cargnelutti</i> has <a href="http://blog.fedecarg.com/2009/06/25/format-a-time-interval-with-the-requested-granularity/">posted a class</a> (DateIntervalFormat) that gives you the difference between a date and "now" in words rather than an integer.
</p>
<blockquote>
This class, a refactored version of Drupal's format_interval function, makes it relatively easy to format an interval value. The format will automatically format as compactly as possible. For example: if the difference between the two dates is only a few hours and both dates occur on the same day, the year, month, and day parts of the date will be omitted.
</blockquote>
<p>
So, instead of getting a value of "86400 seconds" you'd get back something like "5 days 3 hours".
</p>]]></description>
      <pubDate>Thu, 25 Jun 2009 12:56:51 -0500</pubDate>
    </item>
  </channel>
</rss>
