<?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>Wed, 19 Jun 2013 20:22:16 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[Matt Farina's Blog: SplFixedArray, An Underutilized PHP Gem]]></title>
      <guid>http://www.phpdeveloper.org/news/16838</guid>
      <link>http://www.phpdeveloper.org/news/16838</link>
      <description><![CDATA[<p>
<i>Matt Farina</i> has a new post today looking at an "underutilized gem" he's found in the offerings of the Standard PHP Library (SPL) - the <a href="http://engineeredweb.com/blog/11/9/splfixedarray-underutilized-php-gem">SplFixedArray</a>.
</p>
<blockquote>
Arrays in PHP are not arrays per the typical <a href="http://en.wikipedia.org/wiki/Array_data_type">array data type</a>. Instead, as Matt Butcher recently pointed out <a href="http://technosophos.com/content/php-arrays-are-not-arrays">arrays in PHP are similar to hashes in other languages</a>. This can be a very important point to know when tracking down bugs in code and to programmers coming to PHP from other languages. But, what if we wanted something like a traditional array data type? Maybe something that preserved numeric order. Enter <A href="http://engineeredweb.com/blog/11/9/splfixedarray">SplFixedArray</a>.
</blockquote>
<p>
He gives an example of using the SplFixedArray object versus the normal array variables in a simple PHP snippet showing the preservation of numbering order. He also touches on the memory consumption difference between the two, with the fixed array coming in quite a bit lower than the normal array data type (around 25% based on his basic testing). There are some catches to using it, though including incompatibility with array methods and the fact that it doesn't implement things like Iterator or Countable interfaces.
</p>]]></description>
      <pubDate>Fri, 09 Sep 2011 10:43:11 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[DZone.com: How to remove getters and setters]]></title>
      <guid>http://www.phpdeveloper.org/news/15951</guid>
      <link>http://www.phpdeveloper.org/news/15951</link>
      <description><![CDATA[<p>
On DZone.com's Web Builder Zone <i>Giorgio Sironi</i> has posted a few methods you can use to help <a href="http://css.dzone.com/articles/how-remove-getters-and-setters">get rid of getters and setters</a> in your OOP PHP applications.
</p>
<blockquote>
Encapsulation is (not only, but also) about being capable of changing private fields. If you write getters and setters, you introduce a leaky abstraction over private fields, since the names and number of your public methods are influenced coupled to them. They aren't really private anymore: 
</blockquote>
<p>
To show his alternatives, he uses a sample "User" class with a whole list of private properties. There's initially a get/set for the nickname and password values, but he suggests a few replacements:
</p>
<ul>
<li>passing values in through the constructor
<li>using the "Information Architect" pattern to have the most responsible method handle the value setting
<li>the "Double Dispatch" method that uses dependency injection
<li>using the Command pattern and changesets of data
</ul>
<p>
He also briefly mentions the Command-Query Responsibility Segregation (CQRS) method, but doesn't have any code example to go with it.
</p>]]></description>
      <pubDate>Wed, 23 Feb 2011 12:02:17 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[David Sklar's Blog: Fast Multiple String Replacement in PHP]]></title>
      <guid>http://www.phpdeveloper.org/news/15216</guid>
      <link>http://www.phpdeveloper.org/news/15216</link>
      <description><![CDATA[<p>
<i>David Sklar</i> has <a href="http://www.sklar.com/blog/archives/122-Fast-Multiple-String-Replacement-in-PHP.html">a new post to his blog</a> today sharing an extension he's created to make replacing strings in PHP a much faster task - <a href="http://github.com/ning/boxwood">Boxwood</a>.
</p>
<blockquote>
A straightforward way to do [string replacement] in PHP is to pass an array of words to look for and their replacements to a function like <a href="http://php.net/str_replace">str_replace()</a> or <a href="http://php.net/str_ireplace">str_ireplace()</a>. Or, similarly, use a regular expression that gloms the search terms together (and potentially checks word boundaries.) There are assorted <a href="http://wordpress.org/extend/plugins/wp-content-filter/">WordPress plugins</a> that work like this. The problem with this approach is that it's really slow. Especially if you have a lot of words you're looking for. The amount of time it takes to do the search and replace grows in proportion to the number of words you're looking for. This is particularly unfortunate because usually, none of the words are ever found!
</blockquote>
<p>
With the <a href="http://github.com/ning/boxwood">Boxwood</a> extension, the word list can be as long as needed because it uses an <a href="http://en.wikipedia.org/wiki/Trie">ordered tree structure</a> (trie) to parse the entire tree only once so there's much less overhead.
</p>]]></description>
      <pubDate>Fri, 01 Oct 2010 10:09:40 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Richard Heyes' Blog: PEAR::DB replacement class updated]]></title>
      <guid>http://www.phpdeveloper.org/news/8083</guid>
      <link>http://www.phpdeveloper.org/news/8083</link>
      <description><![CDATA[<p>
<i>Richard Heyes</i> has <a href="http://www.phpguru.org/#123">made some updates</a> to his <a href="http://www.phpguru.org/downloads/DB/">PEAR::DB replacement class</a> today, including:
</p>
<ul>
<li>Added numCols() function to the DB_result object
<li>Added seek() method to the DB_result object
<li>Enabled you to specify the fetchmode for getRow() and getAll()
<li>Made the test script easier to navigate
<li>Added reset() method to the DB_result object
</ul>
<p>
You can find out more about the project <a href="http://www.phpdeveloper.org/news/7989">here</a> or just <a href="http://www.phpguru.org/downloads/DB/">download this new version</a> and check out the <a href="http://www.phpguru.org/pear_db_replacement/">documentation</a> to get you started.
</p>]]></description>
      <pubDate>Wed, 20 Jun 2007 08:43:00 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Richard Heyes' Blog: PEAR::DB database class(es) replacement]]></title>
      <guid>http://www.phpdeveloper.org/news/7989</guid>
      <link>http://www.phpdeveloper.org/news/7989</link>
      <description><![CDATA[<p>
In <a href="http://www.phpguru.org/#121">a new post</a> <i>Richard Heyes</i> links to a replacement for the popular PEAR::DB package:
</p>
<blockquote>
PEAR::DB is all well and good if you want to connect to multiple databases (I assume, I've never actually used it with anything other than mysql) but it is somewhat hefty on the bad side of 60k. Not a good thing if you're not using some sort of accelerator and have a high traffic site. Here's a class which replicates the PEAR::DB API (the bits that I use anyhoo) and weighs in at a much nicer ~11k. Sweet.
</blockquote>
<p>
The class is <a href="http://www.phpguru.org/downloads/DB/">posted for download</a> here as a simple <a href="http://www.phpguru.org/downloads/DB/DB.phps">PHP source file</a> with functions and values named similar to those in the PEAR::DB package.
</p>]]></description>
      <pubDate>Wed, 06 Jun 2007 12:39:00 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[ArtyPapers.com: P+C DTR - PHP & CSS Dynamic Text Replacement]]></title>
      <guid>http://www.phpdeveloper.org/news/4478</guid>
      <link>http://www.phpdeveloper.org/news/4478</link>
      <description><![CDATA[In <a href="http://artypapers.com/csshelppile/pcdtr/">this post</a> on ArtyPapers.com today, there's information about a new tool that allows the creation of PHP & CSS dynamic text replacement - P+C DTR.
<p>
<quote>
<i>
PHP + CSS Dynamic Text Replacement is a JavaScript-free version of the <a href="http://www.alistapart.com/articles/dynatext">Dynamic Text Replacement</a> method originally created by <a href="http://www.stewartspeak.com/">Stewart Rosenberger</a>.
<p>
P+C DTR allows you to take a vanilla standards-based (X)HTML web page and dynamically create images to replace and enhance page headings using only PHP + CSS. Sick of using the same three fonts? Tired of editing heading images in PhotoShop? If so, P+C DTR might be for you.
</i>
</quote>
<p>
This is a definite <a href="http://artypapers.com/csshelppile/pcdtr/">must see</a> if you do a lot of web work with something more creative than simple text. This tool allows you to create some very nice text in a short amount of time. And, because it's based on simple, open standards, its use is simple too...]]></description>
      <pubDate>Fri, 09 Dec 2005 07:19:02 -0600</pubDate>
    </item>
  </channel>
</rss>
