<?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, 19 May 2013 09:37:33 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[PHPMaster.com: Base Converting and Binary Operators]]></title>
      <guid>http://www.phpdeveloper.org/news/19480</guid>
      <link>http://www.phpdeveloper.org/news/19480</link>
      <description><![CDATA[<p>
On PHPMaster.com there's a new tutorial from <i>Timothy Boronczyk</i> focusing on <a href="http://phpmaster.com/base-converting-and-binary-operators/">the binary operators in PHP</a> and using them to do some base conversions.
</p>
<blockquote>
This article discusses PHP's binary operators and how to convert between different counting systems. Most programming books and articles only dedicate a page or two to such topics, and although using the operators is really quite simple, there's a fair amount of background knowledge one must have to use them correctly. Instead of giving the same bare-bones treatment that every other reference gives, I'll first provide you the necessary background in number theory. Armed with that knowledge, you'll be able to understand the binary counting system and base conversions… and familiarity with binary digits is the key to successful use of the binary operators!
</blockquote>
<p>
As promised he starts off with some number theory complete with illustrations about base-10 and how the values fit into "buckets" of data. He compares this to base-2 (binary) and only then starts getting into the conversion functions. He shows the usage of things like <a href="http://php.net/decbin">decbin</a> and <a href="http://php.net/dechex">dechex</a> to modify the values as well as the use of bitwise and binary operators.
</p>
Link: http://phpmaster.com/base-converting-and-binary-operators]]></description>
      <pubDate>Thu, 18 Apr 2013 11:44:05 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Sherif Ramadan: How to Write an Operator Precedence Parser in PHP]]></title>
      <guid>http://www.phpdeveloper.org/news/19068</guid>
      <link>http://www.phpdeveloper.org/news/19068</link>
      <description><![CDATA[<p>
<i>Sherif Ramadan</i> has a post looking at <a href="https://sheriframadan.com/2013/01/how-to-write-an-operator-precedence-parser-in-php/">creating a better operator precedence parser</a> in PHP. <a href="https://github.com/srgoogleguy/Mphp/">His example</a> is a fully PHP implementation that takes equation strings and evaluates them to create the result.
</p>
<blockquote>
Operator precedence parsers are very simple on the surface. So don't feel in the least bit intimidated, because by the time you've read through this I hope to have you walk away with a solid foundation on how to write your very own operator precedence parser. The goal is to understand how to solve the problem of operator precedence parsing, and not necessarily to write your own parser. Learning how the problem can be solved is the most important thing to take away from this article.
</blockquote>
<p>
He starts with an introduction to the concepts behind "operator precedence" including processing order and grouping. He also mentions infix and postfix (RPN) notations for handling different formats of equations. He used the "Shunting-yard Algorithm" and how it relates to handling the different parts of the equation, one at a time, in the correct order. He rest of the post is dedicated to the details of the execution in the tool, including code examples and the tokenization of the strings passed into it.
</p>]]></description>
      <pubDate>Mon, 21 Jan 2013 11:21:22 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Reddit.com: How and When do you use Bitwise?]]></title>
      <guid>http://www.phpdeveloper.org/news/17786</guid>
      <link>http://www.phpdeveloper.org/news/17786</link>
      <description><![CDATA[<p>
In <a href="http://www.reddit.com/r/PHP/comments/ruvm8/how_and_when_do_you_use_bitwise/">this new question</a> to Reddit, there's a question about the usage of bitwise operators - when they might come in useful.
</p>
<blockquote>
As I get deeper into PHP I notice some lower level functionality that looks like it could be interesting, maybe even useful. I'm trying (other than switching the hex value of a color) to figure out when Bitwise operators might come in handy. Any real world examples?
</blockquote>
<p>
Responses to the post mention a few cases they'd be useful in - handling permissions, route matching and error reporting. You can find out more about bitwise operators in PHP <a href="http://us3.php.net/manual/en/language.operators.bitwise.php">the PHP manual</a>.
</p>]]></description>
      <pubDate>Fri, 06 Apr 2012 10:30:32 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Stoimen Popov's Blog: PHP Performance: Bitwise Division]]></title>
      <guid>http://www.phpdeveloper.org/news/17357</guid>
      <link>http://www.phpdeveloper.org/news/17357</link>
      <description><![CDATA[<p>
<i>Stoimen Popov</i> has <a href="http://www.stoimen.com/blog/2012/01/05/php-performance-bitwise-division/">a new post</a> to his blog today comparing the performance of bitwise division versus the normal "/" division operator.
</p>
<blockquote>
Recently I wrote about <a href="http://www.stoimen.com/blog/2011/12/26/computer-algorithms-binary-search/">binary search</a> and then I said that in some languages, like PHP, bitwise division by two is not faster than the typical "/" operator. However I decided to make some experiments and here are the results.
</blockquote>
<p>
According to <a href="http://www.stoimen.com/blog/wp-content/uploads/2012/01/bitwise-divide-by-two.png">his results</a> using the bitwise method is slightly faster, but you'd only really notice it when working with large sets of data (like his example using 10,000,000). The code to run his benchmarks is included in the post.
</p>]]></description>
      <pubDate>Fri, 06 Jan 2012 09:26:38 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Sameer Borate's Blog: Disabling the silence @-operator in PHP]]></title>
      <guid>http://www.phpdeveloper.org/news/14747</guid>
      <link>http://www.phpdeveloper.org/news/14747</link>
      <description><![CDATA[<p>
As <i>Sameer Borate</i> points out in <a href="http://www.codediesel.com/php/disabling-the-silence-operator-in-php">his latest post</a> to his blog, there's a way to disable that pesky suppression operator (@) in your PHP installation thanks to the <a href="http://pecl.php.net/package/scream">scream extension</a>.
</p>
<blockquote>
PHP supports one error control operator: the at sign (@). When prepended to an expression any error generated by that expression will be ignored. It can also be useful for hiding errors generated by various functions. [...] Although quite useful at some times, using the @-operator can have some annoying side effects. 
</blockquote>
<p>
He shows you how to install the extension on a stock Ubuntu platform (including the PHP packages) and how use the feature in your application by means of a call to <a href="http://php.net/ini_set">ini_set</a> (or, of course, setting it in your php.ini file).
</p>]]></description>
      <pubDate>Tue, 06 Jul 2010 08:42:22 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Johannes Schluter's Blog: Class posing and overloading the "new" operator]]></title>
      <guid>http://www.phpdeveloper.org/news/13795</guid>
      <link>http://www.phpdeveloper.org/news/13795</link>
      <description><![CDATA[<p>
In <a href="http://schlueters.de/blog/archives/124-Class-posing-and-overloading-the-new-operator.html">this recent post</a> to his blog <i>Johannes Schluter</i> talks about a method he's suggested for testing objects in unit tests - overriding the "new" operator to replace specific classes with mocks.
</p>
<blockquote>
Two years ago at some conference I had a conversation with Sebastian about the need for a way to overload the new operator in PHP so, probably, bad designed code can be tested more easily by replacing specific classes with mocks.  [...] Sebastian then pushed the code as part of a new test_helpers extension with some documentation <a href="http://github.com/sebastianbergmann/php-test-helpers/">to github</a> and I fixed some bugs in it. The aim of the extension is to collect functionality which might be beneficial for phpUnit and other test scenarios but which should never reach a production environment.
</blockquote>
<p>
He includes some sample code to show it in action - defining the mock class, using the set_new_overload function to define it as what should be called when the "new" operator is used and a dump of the result.
</p>]]></description>
      <pubDate>Thu, 07 Jan 2010 10:24:16 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[ThinkPHP Blog: Silence of the LAMPs]]></title>
      <guid>http://www.phpdeveloper.org/news/13231</guid>
      <link>http://www.phpdeveloper.org/news/13231</link>
      <description><![CDATA[<p>
In <a href="http://blog.thinkphp.de/archives/424-Silence-of-the-LAMPs.html">a recent post</a> to the ThinkPHP blog <i>Martin Brotzeller</i> looks at a PHP operator that developers should just not use anymore - the suppression operator (@).
</p>
<blockquote>
The silence operator exists to give programmers an easy way to suppress messages when a command might fail and the code checks for success itself (i.e. in those cases that raise errors instead of throwing exceptions).
</blockquote>
<p>
He points out a popular use (like putting it on an fopen to prevent it from throwing an E_WARNING) but notes that this could cause trouble if the code is several layers deep and seems to fail silently. He gives en example of the Zend_Loader component of the Zend Framework and how, if the suppression operator was used, errors with an include failed without so much as a blip in the error log. While it seems handy, the suppression operator can cause more harm than good in the long run. 
</p>]]></description>
      <pubDate>Wed, 16 Sep 2009 09:13:40 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Mark van der Velden's Blog: PHP Quiz part 2]]></title>
      <guid>http://www.phpdeveloper.org/news/12514</guid>
      <link>http://www.phpdeveloper.org/news/12514</link>
      <description><![CDATA[<p>
<i>Mark van der Velden</i> has posted <a href="http://blog.dynom.nl/archives/PHP-Quiz-part-2_20090514_27.html">another PHP quiz</a> you can used to test your knowledge of the language:
</p>
<blockquote>
A short quiz this time, but that doesn't make it less fun. Do you know the answer to all of them? Get a cup of coffee and kill 10 minutes with round two... As always, think of the answer before you execute the code or look it up. You can find round one <a href="http://blog.dynom.nl/archives/PHP-Quiz-part-1_20080424_23.html">here</a>.
</blockquote>
<p>
This one has questions on arrays, ArrayAccess, references, operator precedence and nesting structures. There's no answer key, so you'll just have to test it out if you want to see the answer.
</p>]]></description>
      <pubDate>Thu, 14 May 2009 12:05:22 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[PHPBuilder.com: Loops & Decisions in PHP - The ABC's of PHP Part 8]]></title>
      <guid>http://www.phpdeveloper.org/news/12475</guid>
      <link>http://www.phpdeveloper.org/news/12475</link>
      <description><![CDATA[<p>
PHPBuilder.com has posted <a href="http://www.phpbuilder.com/columns/peter_shaw05062009.php3">the eighth part</a> of their introductory "ABCs of PHP" series today. This time the focus is on looping and decision functionality (like if/while/for/etc).
</p> 
<blockquote>
n any given computer language (PHP is no exception) there has to be a way to allow the running code to decide between doing 2 different things. If there wasn't then software would not be able to adapt based on operating conditions, or it wouldn't be able to decide between two different users. 
</blockquote>
<p>
They look at using: if statements and operators, for loops and while loops. When they look at the operators, they talk about the differences between equals/not equals, grater than/less than and two of the boolean operators - AND and OR.
</p>]]></description>
      <pubDate>Thu, 07 May 2009 10:26:34 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Johannes Schluter's Blog: Scream!]]></title>
      <guid>http://www.phpdeveloper.org/news/12037</guid>
      <link>http://www.phpdeveloper.org/news/12037</link>
      <description><![CDATA[<p>
After being tasked with some code that was filled with the suppression character (@) all over, <i>Johannes Schluter</i> decided to take matters into his own hands and write an extension to disable it.
</p>
<blockquote>
That's annoying. So I wrote a simple extension disabling this operator. That helped. I then proposed that extension to <A href="http://pecl.php.net/">pecl</a>, while doing that I found out that <a href="http://t3.dotgnu.info/blog/php/breaking-the-silence.html">Gopal has written a similar extension</a> before. After short discussions we added that extension, using the name <a href="http://pecl.php.net/scream">scream</a> to pecl and released the extension there.
</blockquote>
<p>
Documentation for the extension has <a href="http://php.net/scream">already been added</a> to the PHP manual for the "Break the Silence" operator. By enabling the setting (either in your php.ini or via an <a href="http://php.net/ini_set">ini_set</a>) turning on "scream_enabled", any use of the suppression operator (@) will be nulled out and all according error messages will be displayed. 
</p>]]></description>
      <pubDate>Fri, 27 Feb 2009 11:14:50 -0600</pubDate>
    </item>
  </channel>
</rss>
