<?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 11:34:33 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[PHPMaster.com: An Introduction to Ctype Functions]]></title>
      <guid>http://www.phpdeveloper.org/news/19526</guid>
      <link>http://www.phpdeveloper.org/news/19526</link>
      <description><![CDATA[<p>
On PHPMaster.com today <i>David Shirey</i> has a written up a new tutorial <a href="http://phpmaster.com/an-introduction-to-ctype-functions/">introducing the ctype functions</a> in PHP. This set of functions provides a handy way to more correctly check values to ensure they're valid (and contain what they should).
</p>
<blockquote>
If you have a background in C, then you're probably already familiar with the character type functions because that is where they come from (don't forget that PHP is actually written in C). But if you're into Python, then it's only fair to point out that the PHP Ctype functions have absolutely nothing to do with the Python's ctypes library. It's just one of those tragic and totally unavoidable naming similarities.
</blockquote>
<p>
He briefly explains how the functions work and at least one "gotcha" to watch out for if you're using them for input validation. He then goes through the list of the eleven ctype functions and briefly describes what they do. Some example code is also included showing how you can use them to validate a value based on the true/false return from the function call.
</p>
Link: http://phpmaster.com/an-introduction-to-ctype-functions]]></description>
      <pubDate>Tue, 30 Apr 2013 11:38:32 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Phil Sturgeon: Understanding Circumstance]]></title>
      <guid>http://www.phpdeveloper.org/news/18390</guid>
      <link>http://www.phpdeveloper.org/news/18390</link>
      <description><![CDATA[<p>
<i>Phil Sturgeon</i> has <a href="http://philsturgeon.co.uk/blog/2012/08/understanding-circumstance">a new post to his site</a> today comparing a few different types of developers and discussing language/tool zealots among them (and a plea for tolerance and understanding).
</p>
<blockquote>
What is it you do as a developer? As I see it in web dev there are a few different types: Hobbiest, Client Web Dev, Distributed Application Devs, Web App Developer (SaaS) and Corporate Dev. What do they all have in common? They're all using some sort of language to make some sort of system for somebody somewhere. That is about the last connecting factor that most of us developers actually share. [...] The crazy thing here is that most developers who are in a situation where they can use whatever system they like, often end up picking a specific tool and using it to death. This is ridiculous, as every developer should use the best tool for the job. 
</blockquote>
<p>
He talks a bit about each of the different categories of developers and where he sees their place in the world of development. He points out some of the restrictions of each type of position (required technologies, dependencies, etc) and comes to his point about their choices:
</p>
<blockquote>
The point I am trying to make in all of this, is that while you might have really strong opinions about what language, framework, version of the framework or version of the language you use, EVERYONE has a totally different situation to you.
</blockquote>]]></description>
      <pubDate>Wed, 22 Aug 2012 10:15:08 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[DZone.com: The Best Unknown Databases for PHP Apps]]></title>
      <guid>http://www.phpdeveloper.org/news/18321</guid>
      <link>http://www.phpdeveloper.org/news/18321</link>
      <description><![CDATA[<p>
In <a href="http://architects.dzone.com/articles/best-unknown-databases-php">this new post</a> to DZone.com today <i>Leigh Shevchik</i> kicks off a series of posts looking at the "unknown databases" that PHP developers might not think about when working on their applications.
</p>
<blockquote>
In this day and age, there a plethora of options available to us. In this three part series, I'm going to walk you through five alternative databases that you may or may not have heard of. [...] Whether you're involved in embedded development, OLTP, OLAP, massive scalability and storage or simple database-backed applications, you're not going to walk away with the same perspective that you had before you started reading these posts. So without further ado, let's get started with a look at a veteran of the Internet: <a href="http://www.aosabook.org/en/bdb.html">Berkeley DB</a>.
</blockquote>
<p>
She covers some of the database's basic features and a bit about its history (available for years) as well as some detail on how requests to the database work. To make the connection from your application, you'll need to install the <a href="http://www.php.net/manual/en/dba.installation.php">dba PHP extension</a>. She provides two examples of code that uses the database - one that just connects and deletes a record, another that adds/removes/finds users from an "address book" database.
</p>]]></description>
      <pubDate>Mon, 06 Aug 2012 10:49:50 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Community News: PHP Benchmarks Compared to Several Languages]]></title>
      <guid>http://www.phpdeveloper.org/news/18271</guid>
      <link>http://www.phpdeveloper.org/news/18271</link>
      <description><![CDATA[<p>
<i>Ariz Jacinto</i> has <a href="http://www.mentby.com/ariz-jacinto/see-how-php-outperforms-other-scripting-languages-in-the-latest-computer-language-benchmarks-game.html">pointed out some results</a> from a recent benchmarking "game" that compares the performance of several languages against each other in overall speed.
</p>
<blockquote>
Here's the <a href="http://shootout.alioth.debian.org/u64q/which-programming-languages-are-fastest.php?gpp=on&java=on&php=on&python3=on&yarv=on&perl=on&calc=chart">link</a> to the Computer Language Benchmark Game as of July 
15, 2012. You'll see that the median speed of PHP is slightly faster 
than Python 3 and Ruby 1.9 on x64 Ubuntu/IntelQ6600 Quad-core machine.
</blockquote>
<p>
You can <a href="http://shootout.alioth.debian.org/u64q/which-programming-languages-are-fastest.php?gpp=on&java=on&php=on&python3=on&yarv=on&perl=on&calc=chart">visit the results page</a> and turn on and off various languages to get the updated results in the chart. You can also limit it down to one of the many benchmarking test types as well.
</p>]]></description>
      <pubDate>Wed, 25 Jul 2012 09:14:41 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[John Sonmez's Blog: Types of Duplication in Code]]></title>
      <guid>http://www.phpdeveloper.org/news/18019</guid>
      <link>http://www.phpdeveloper.org/news/18019</link>
      <description><![CDATA[<p>
On his "Simple Programmer" blog <i>John Sonmez</i> has <a href="http://simpleprogrammer.com/2012/05/27/types-of-duplication-in-code/">a new post</a> looking at three kinds of "code duplication" that you should keep an eye out for when coding your applications:
</p>
<blockquote>
One of the biggest reasons to refactor code is to eliminate duplication.  It is pretty easy to introduce duplication in our code either unintentionally or because we don't know how to prevent or get rid of it. [...] I've found that there are three basic types of duplication that we can eliminate from our code that successfully build on each other.
</blockquote>
<p>
He describes the three types - data, type and algorithm - and gives some code snippets showing how they present themselves and simple solutions of how to resolve them. There's also a quick mention of a "combined attack" when more than one form of duplication shows up at once. He suggests a to help find the "edges" of the duplication:
</p>
<blockquote>
I've also found the key to eliminating duplication is sometimes to first exaggerate it.  Often I will purposely take two methods that I know have some duplication and make them look even more duplicated in order to be able to clearly see where the duplication lies.
</blockquote>]]></description>
      <pubDate>Tue, 29 May 2012 13:58:03 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Anthony Ferrara's Blog: PHP's Source Code For PHP Developers - Part 3 - Variables]]></title>
      <guid>http://www.phpdeveloper.org/news/17711</guid>
      <link>http://www.phpdeveloper.org/news/17711</link>
      <description><![CDATA[<p>
The third part of the "PHP source for developers" series has been posted over on <i>Anthony Ferrara</i>'s blog today looking at <a href="http://blog.ircmaxell.com/2012/03/phps-source-code-for-php-developers_21.html">the variables PHP's internals use</a>.
</p>
<blockquote>
In this third post of the PHP's Source Code for PHP Developers series, we're going to expand on the prior posts to help understand how PHP works internally.  In the first post of the  series, we looked at how to view PHP's source code, how it's structured as well as some basic C pointers for PHP developers.  The second post introduced functions into the mix.  This time around, we're going to dive into one of the most useful structures in PHP: variables.
</blockquote>
<p>
He starts with one of the most important variable types used in PHP's source - the ZVAL. This is one of the keys to PHP's loose typing and can be thought of as "a class with only public properties". He gets into more detail with the properties of this "class" (value, refcount__gc, type and is_ref__gc). Also included is a look at how it's actually used - creating new ones, getting the value of them, converting their types and how the internal PHP functions parse their variables.
</p>
<p>
There's a lot more covered about variables in <a href="http://blog.ircmaxell.com/2012/03/phps-source-code-for-php-developers_21.html">the post</a> so if this is interesting stuff to you, be sure to read it all. They've done a great job of explaining one of the more complicated parts of the internals that power PHP.
</p>]]></description>
      <pubDate>Thu, 22 Mar 2012 08:30:45 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Joseph Scott's Blog: Why PHP Strings Equal Zero]]></title>
      <guid>http://www.phpdeveloper.org/news/17679</guid>
      <link>http://www.phpdeveloper.org/news/17679</link>
      <description><![CDATA[<p>
<i>Joseph Scott</i> has a new post to his blog looking at "<a href="http://josephscott.org/archives/2012/03/why-php-strings-equal-zero/">why PHP strings equal zero</a>" - that when you use the "==" operator on a string to compare to zero, it's true.
</p>
<blockquote>
The issue of PHP strings equaling zero has come up a few times recently. [...] Running that will display Equals zero!, which at first glance probably doesn't make much sense. So what is going on here?
</blockquote>
<p>
He gets into the specifics of what's happening - a bit of type jugging, less strict comparison since it's the "==" versus "===" and how the <a href="http://php.net/manual/en/language.types.string.php">PHP manual</a> talks about strings being converted to numbers. 
</p>
<blockquote>
While I still think it is odd that the string gets cast as an integer instead of the other way around, I don't think this is a big deal. I can't recall a single time where I've ever run into this issue in a PHP app. I've only seen it come up in contrived examples like the ones above.
</blockquote>]]></description>
      <pubDate>Thu, 15 Mar 2012 09:47:49 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Brandon Savage's Blog: An XSS Vulerability In The Making]]></title>
      <guid>http://www.phpdeveloper.org/news/17640</guid>
      <link>http://www.phpdeveloper.org/news/17640</link>
      <description><![CDATA[<p>
<i>Brandon Savage</i> has a new post to his blog about what he calls a <a href="http://www.brandonsavage.net/an-xss-vulerability-in-the-making/">XSS vulnerability in the making</a>, something to watch out for when you're doing validation in PHP involving the possibility of numbers as strings.
</p>
<blockquote>
Back in September, <a href="https://crash-stats.mozilla.org/">Socorro</a> received a <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=689675">security bug</a> relating to the method we were using for processing inputs for the duration of certain reports. The vulnerability included a proof of concept, with an alert box popping up on production when the link was followed. [...] I was quite surprised at the root cause of the vulnerability. We had opted to compare the incoming data against a known set of valid values - a common practice when whitelisting certain inputs. [...] As expected, when this [example] code is tested, a string of '3' and an integer of 3 work equally well, and a string of '5' and an integer of 5 fail equally. 
</blockquote>
<p>
This automatic casting that PHP does internally caused another issue as well - if the string passed in even started with a valid number from their whitelist set, it still passed.
</p>
<blockquote>
At first we thought this surely had to be a bug in PHP. However, Laura Thomson told me "If comparing two values, type juggling is performed first, which means that the string is converted to a number. This is done by <a href="http://us2.php.net/manual/en/language.types.string.php#language.types.string.conversion">taking the first number found in the string</a>. So this may be confusing/a quirk/a gotcha, but it isn't a bug." And she's right: this isn't a bug per se, but it's certainly an interesting "gotcha."
</blockquote>]]></description>
      <pubDate>Wed, 07 Mar 2012 12:02:46 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Nikita Popov's Blog: Scalar type hinting is harder than you think]]></title>
      <guid>http://www.phpdeveloper.org/news/17638</guid>
      <link>http://www.phpdeveloper.org/news/17638</link>
      <description><![CDATA[<p>
In <a href="http://nikic.github.com/2012/03/06/Scalar-type-hinting-is-harder-than-you-think">this new post</a> to his blog <i>Nikita</i> talks about scalar type hinting and why it's harder than most people think to accomplish.
</p>
<blockquote>
One of the features originally planned for PHP 5.4 was scalar type hinting. But as you know, they weren't included in the release. Recently the topic has come up again on the mailing list and there has been a hell lot of discussion about it. Yesterday ircmaxell published a <a href="http://blog.ircmaxell.com/2012/03/parameter-type-casting-in-php.html">blog post about his particular proposals</a>. The reactions on <a href="http://www.reddit.com/r/PHP/comments/qiniv/parameter_type_casting_in_php/">reddit</a> were mixed. On one hand it is clear that people do really want scalar type hints, on the other hand they didn't seem to like that particular proposal.
</blockquote>
<p>
He gets into some of the details of some of the current proposals and their problems like the strict versus loosely-typed nature of PHP and type hinting that was included but not enforced. One he does like, however, is one based on casting - how the variable ends up being cast rather than the specific type it is when it comes into the function/method. This one still has its flaws, so he suggests another method - weak type hints but with stricter input validation (without casting). He also briefly mentions something called "box based type hinting" that would allow users to define their own hinting rules.
</p>
<p>
Don't worry - code examples (pseudo-code obviously) <a href="http://nikic.github.com/2012/03/06/Scalar-type-hinting-is-harder-than-you-think">are included</a> for each of these proposals to help you understand the differences.
</p>]]></description>
      <pubDate>Wed, 07 Mar 2012 10:03:47 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Anthony Ferrara's Blog: Parameter Type Casting in PHP]]></title>
      <guid>http://www.phpdeveloper.org/news/17632</guid>
      <link>http://www.phpdeveloper.org/news/17632</link>
      <description><![CDATA[<p>
<i>Anthony Ferrara</i> has a new article posted to his site today about <a href="http://blog.ircmaxell.com/2012/03/parameter-type-casting-in-php.html">parameter typecasting</a> and the discussions that have been happening about it on the PHP "<a href="http://php.net/mailing-lists.php">internals</a>" mailing list.
</p>
<blockquote>
As any of you who follow the <a href="http://news.php.net/php.internals">PHP internals</a> list know, scalar type hinting has been a hot topic as of late.  You'll also know that I've submitted two new RFC (Request For Comment) proposals for inclusion of two new major features in the PHP language.  I figured it was worth going into both RFCs and patches a little deeper, explain my rationale and (hopefully) garner some more visibility of the proposals.
</blockquote>
<p>
He shares the details of the two main RFCs that are proposed right now - parameter type casting hints and object scalar casting magic methods (both with code examples). Right now, they're only in the patch stage and there's talk of improving the current casting functionality of PHP before something like one of these goes into place. 
</p>]]></description>
      <pubDate>Tue, 06 Mar 2012 11:05:32 -0600</pubDate>
    </item>
  </channel>
</rss>
