<?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>Fri, 24 May 2013 05:28:42 -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[Igor Wiedler: Binary parsing with PHP]]></title>
      <guid>http://www.phpdeveloper.org/news/18518</guid>
      <link>http://www.phpdeveloper.org/news/18518</link>
      <description><![CDATA[<p>
<i>Igor Wiedler</i> has a new post to his blog showing how to <a href="https://igor.io/2012/09/24/binary-parsing.html">work with binary data</a> in your PHP applications a few different built-in functions including <a href="http://php.net/unpack">unpack</a> and <a href="http://php.net/bindec"> bindec</a>.
</p>
<blockquote>
Binary operations in PHP are a bit strange. Since PHP was originally a templating layer for C code, it still has many of those C-isms. Lots of the function names map directly to C-level APIs, even if they work a bit differently sometimes. For example, PHP's strlen maps directly to STRLEN(3), and there are countless examples of this. However, as soon as it comes to dealing with binary data, things suddenly become very different.
</blockquote>
<p>
He starts off looking at "the C way" to unpack a string (getting the ASCII values of each character) and shows how *not* to do it in PHP with <a href="http://php.net/ord">ord</a>. Instead he uses "unpack", bitwise operators and bindec to work with the actual binary data of the string.
</p>]]></description>
      <pubDate>Tue, 25 Sep 2012 12:17:41 -0500</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>
  </channel>
</rss>
