<?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>Sun, 12 Feb 2012 21:23:34 -0600</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[PHPCodeBase.com: PHP Magic Function : glob()]]></title>
      <guid>http://www.phpdeveloper.org/news/16134</guid>
      <link>http://www.phpdeveloper.org/news/16134</link>
      <description><![CDATA[<p>
On PHPCodeBase.com there's a recent post looking at <a href="http://www.phpcodebase.com/php-magic-function-glob/">a handy file system function</a> that you can use to search directories simpler than a usual opendir/readdir method - <a href="http://php.net/glob">glob</a>.
</p>
<blockquote>
Are you guys still using <a href="http://php.net/manual/en/function.opendir.php">opendir()</a> function to read the the files from the folder in PHP? Luckily PHP have the <a href="http://php.net/manual/en/function.glob.php">glob()</a> function which perform this task very faster and smarter.
</blockquote>
<p>
He compares an example of the opendir/readdir method to a few line replacement with glob, both searching the same directory for files. He looks at the arguments you can pass into glob - the path to search and a flag that adds special handling to the method (like turning off sorting, modifying the regular expression handling and stopping on errors).
</p>]]></description>
      <pubDate>Fri, 01 Apr 2011 08:21:20 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[SitePoint PHP Blog: How to Tidy Your WordPress Menu HTML]]></title>
      <guid>http://www.phpdeveloper.org/news/15808</guid>
      <link>http://www.phpdeveloper.org/news/15808</link>
      <description><![CDATA[<p>
On the SitePoint PHP blog today there's a new post from <i>Craig Buckler</i> for the WordPress users out there. The HTML that this popular blog/CMS tools spits out can sometimes be not-so-semantic. <i>Craig</i> <a href="http://blogs.sitepoint.com/2011/01/26/wordpress-menu-html-tidy/">shares a tip</a> on cleaning up one aspect of it - the methods returning lists for menus or sitemaps.
</p>
<blockquote>
love WordPress. I also love clean semantic HTML. Unfortunately, several of the standard WordPress theme functions return code that is a little untidy. For me, the primary culprits are <a href="http://codex.wordpress.org/Function_Reference/wp_list_pages">wp_list_pages()</a> and the newer <a href="http://codex.wordpress.org/Function_Reference/wp_nav_menu">wp_nav_menu()</a>; both return an unordered list of page links.
</blockquote>
<p>
He gives an example of a sample list generated by wp_nav_menu() that's full of badly formatted and unnecessary elements. To help fix the issue, he shares his regular expression-based call to strip out things like extra tabs, empty classes and all title attributes. Obviously you can customize this as you need, but it's a good start towards something that's a bit cleaner and up to code.
</p>]]></description>
      <pubDate>Wed, 26 Jan 2011 09:37:59 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[PHPBuilder.com: 10 Easy Examples for Deciphering PHP Regular Expressions]]></title>
      <guid>http://www.phpdeveloper.org/news/14828</guid>
      <link>http://www.phpdeveloper.org/news/14828</link>
      <description><![CDATA[<p>
On PHPBuilder.com today <i>Jason Gilmore</i> has posted <a href="http://www.phpbuilder.com/columns/Regular-Expressions/Jason_Gilmore072010.php3">ten easy regular expression tips</a> that can help you understand the matching on some of the common pieces of data your app might come across.
</p>
<blockquote>
Regular expressions are the PHP programmer's equivalent of being audited by the IRS. The mere thought of an encounter is enough to cause heart palpitations. [...] If you would like to decipher the melange of backslashes, brackets, asterisks and other characters somehow capable of rooting out everything from email addresses to HTML tags, follow along with this tutorial which introduces the topic using 10 numerically-oriented examples.
</blockquote>
<p>
He starts simple - finding digits - and progresses into matching groups, filtering strings, using more complex patterns, correcting errors you might find in the data and a note that, despite their power, you don't always need them. There could be a simpler way.
</p>]]></description>
      <pubDate>Wed, 21 Jul 2010 11:26:03 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Stoimen Popov's Blog: preg_match Give Names to the Matches]]></title>
      <guid>http://www.phpdeveloper.org/news/14750</guid>
      <link>http://www.phpdeveloper.org/news/14750</link>
      <description><![CDATA[<p>
In <a href="http://www.stoimen.com/blog/2010/07/03/php-preg_match-give-names-to-the-matches/">a quick post</a> to hos blog today <i>Stoimen Popov</i> points out a handy feature of the <a href="http://php.net/preg_match">preg_match</a> function in PHP (in PHP 5.2.2 and higher) to be able to name the results of the regular expression match.
</p>
<blockquote>
In PHP 5.2.2+ you can name the sub patterns returned from preg_match  with a specific syntax. [...] This is extremely helpful, when dealing with long patterns. [...] Although it may look difficult to maintain, now you can simply name the sub patterns of preg_match and to call them with their associative array keys. This is more clear when writing code and it's definitely more maintainable.
</blockquote>
<p>
The key is to use a special syntax as a part of the expression's pattern. This replaces the numeric keys of the matches with values you define, making it simpler to use the results (instead of having to work with numbers that don't match much of anything). Code and expression examples are included.
</p>]]></description>
      <pubDate>Tue, 06 Jul 2010 11:01:48 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[NETTUTS.com: Advanced Regular Expression Tips and Techniques]]></title>
      <guid>http://www.phpdeveloper.org/news/14369</guid>
      <link>http://www.phpdeveloper.org/news/14369</link>
      <description><![CDATA[<p>
NETTUTS.com has posted an <a href="http://net.tutsplus.com/tutorials/php/advanced-regular-expression-tips-and-techniques/">advanced guide to regular expressions</a> that just happens to use the PHP <a href="http://us.php.net/manual/en/ref.pcre.php">PCRE functions</a> to do the matching.
</p>
<blockquote>
Regular Expressions are the Swiss Army knife for searching through information for certain patterns. They have a wide arsenal of tools, some of which often go undiscovered or underutilized. Today I will show you some advanced tips for working with regular expressions.
</blockquote>
<p>They have it broken out into several tips including:</p>
<ul>
<li>Using Callbacks
<li>Lookahead and Lookbehind Assertions
<li>Filtering Patterns
<li>Named Subpatterns
</ul>
<p>
There's also a section called "Don't Reinvent the Wheel" with a few handy expressions to do common things like parse [X]HTML and validating form input.
</p>]]></description>
      <pubDate>Mon, 19 Apr 2010 09:47:04 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Padraic Brady's Blog: PCRE Regex Word Matching: "w" vs "a-zA-Z0-9_"]]></title>
      <guid>http://www.phpdeveloper.org/news/13732</guid>
      <link>http://www.phpdeveloper.org/news/13732</link>
      <description><![CDATA[<p>
<i>Padraic Brady</i> has <a href="http://blog.astrumfutura.com/archives/430-PCRE-Regex-Word-Matching-w-vs-a-zA-Z0-9_.html">posted about</a> an issue he noticed when working with regular expressions and the "word" character type to find something that's alpha-numeric (including an underscore):
</p>
<blockquote>
You can find the "word" generic character type used in a lot of PHP code including the Zend Framework. The problem is that the assumption above is incorrect. Now, most of the time these act identically because PHP is compiled using its own packaged PCRE library. However, I've seen more than once systems where this is not the case. Usually in some non-English capacity where additional locale support was considered necessary or standard practice.
</blockquote>
<p>
The problem comes when PHP is compiled against a custom PCRE library, making it more locale-aware. He gives instructions on how to get this to a testable state on your environment (using an <a href="ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.00.tar.gz">updated PREC library</a>) and get it working for characters in French, like the accented "a" or "e".
</p>]]></description>
      <pubDate>Mon, 28 Dec 2009 09:41:21 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Jordi Boggiano's Blog: Major glob() fail]]></title>
      <guid>http://www.phpdeveloper.org/news/13633</guid>
      <link>http://www.phpdeveloper.org/news/13633</link>
      <description><![CDATA[<p>
<i>Jordi Boggiano</i> <a href="http://seld.be/notes/major-glob-fail">had the "pleasure"</a> of discovering a small quirk with PHP's <a href="http://php.net/glob">glob</a> function in an application he was working on - watch out for directories that contain square braces, they won't return in the results!
</p>
<blockquote>
Working on some personal project that lists a bunch of stuff on my hard drive, I found out that directories that contain square brackets (those []) don't return any results for the simple reason that glob reads [stuff] as a character class, just like in regular expressions. When you know it it makes perfect sense, but when you don't, the documentation is really not so helpful. Of course it mentions libc's glob() and unix shells, but not everyone knows what that implies at first glance.
</blockquote>
<p>
He tried a few things to get around the bug (including escaping the brackets in the directories) but ended up writing a function (glob_quote) to handle the escaping of all of the meta-characters glob might need to escape to return all of the files and folders correctly.
</p>]]></description>
      <pubDate>Mon, 07 Dec 2009 13:50:54 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[PHPFreaks.com: PCRE Regex Spotlight: K]]></title>
      <guid>http://www.phpdeveloper.org/news/13104</guid>
      <link>http://www.phpdeveloper.org/news/13104</link>
      <description><![CDATA[<p>
On the PHPFreaks.com blog today there's <a href="http://www.phpfreaks.com/blog/pcre-regex-spotlight-k">a quick new post</a> looking at one of the special backslash strings that doesn't get talked about very much - K - but is quite powerful.
</p>
<blockquote>
One backslash sequence that doesn't get much attention is K. What this handy little assertion does is match the position of whatever string comes before it in the pattern, then it in essence resets the match. At that point it starts a new match with whatever comes after K from the current location in the subject string.
</blockquote>
<p>
They include a series of PHP code examples showing how use can use it to work around some of the issues with lookbehind assertions. They also include a few benefits and drawbacks of using them over lookbehinds.
</p>]]></description>
      <pubDate>Tue, 25 Aug 2009 10:28:44 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[DevShed: Working with Regular Expressions with Filters in PHP 5]]></title>
      <guid>http://www.phpdeveloper.org/news/13037</guid>
      <link>http://www.phpdeveloper.org/news/13037</link>
      <description><![CDATA[<p>
New on DevShed today there's the <a href="http://www.devshed.com/c/a/PHP/Working-with-Regular-Expressions-with-Filters-in-PHP-5/">fifth part of their series</a> looking at validation and filtering in PHP5 applications.
</p>
<blockquote>
Among the enhancements that were introduced originally in PHP 5, there's one powerful extension that has been all but ignored by many programmers until now, quite possibly because they weren't aware of its existence.  [...] In this fifth part of the series, I'm going to discuss the usage of the [filter] extension for checking if the value that has been assigned to a given variable follows a specified regular expression pattern.
</blockquote>
<p>
They <a href="http://www.devshed.com/c/a/PHP/Working-with-Regular-Expressions-with-Filters-in-PHP-5/2/">include examples</a> of using the FILTER_VALIDATE_REGEX option for <a href="http://php.net/filter_var">filter_var</a> to check the input against a given format. You'll have to find an introduction to regular expressions someplace else, though - they just assume you know how to work with them.
</p>]]></description>
      <pubDate>Thu, 13 Aug 2009 08:10:06 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[PHPBuilder.com: The ABC's of PHP - Part 10 - The Final Installment (XML & Regex)]]></title>
      <guid>http://www.phpdeveloper.org/news/12615</guid>
      <link>http://www.phpdeveloper.org/news/12615</link>
      <description><![CDATA[<p>
PHPBuilder.com finishes off their "ABCs of PHP" series today with <a href="http://www.phpbuilder.com/columns/peter_shaw06012009.php3">this last tutorial</a> covering a script to fetch the latest headlines from Slashdot and parse the resulting XML with regular expressions.
</p>
<blockquote>
Well my loyal readers (and you must be loyal if you've made it this far). Here we are at the final installment of the 'ABC's of PHP' where we are going to put some of what we've learned over the past couple of months into practice. We're going to go step by step through a small script to read the latest headlines from Slashdot.org [...] As the feed is very simple however, I decided to simply just use 'preg_xxx' calls to elaborate on the material from part 9 on using reg-ex calls, if you where reading anything more complex then you would almost certainly want to use the proper XML functions. 
</blockquote>
<p>
The actual parsing is pretty simple - grabbing each story, date, time and title element from the XML content and pushing it all into an array. The result is a nice array you can loop through and display via the method of your choosing.
</p>]]></description>
      <pubDate>Wed, 03 Jun 2009 08:48:31 -0500</pubDate>
    </item>
  </channel>
</rss>

