<?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>Sat, 25 May 2013 15:46:49 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[David Sklar's Blog: Visiting each character in a string]]></title>
      <guid>http://www.phpdeveloper.org/news/7710</guid>
      <link>http://www.phpdeveloper.org/news/7710</link>
      <description><![CDATA[<p>
In a <a href="http://www.sklar.com/blog/archives/107-Visiting-each-character-in-a-string.html">new post today</a>, <i>David Skalr</i> demonstrates how he solved a simple problem - looping through all of the characters in a string in a UTF-8 enabled environment.
</p>
<blockquote>
So I've got this string (in PHP) and I need to scan through it character by character. I can't scan byte by byte because it's 2007, our users write in <a href="http://blogyazarlari.ning.com/">all sorts</a> <a href="http://canusa.ning.com/profiles/blog/show?id=674817%3ABlogPost%3A261">of languages</a>, and the string is UTF-8.
</blockquote>
<p>
To remedy the situation, he falls back on an old standby - <a href="http://us.php.net/manual/en/ref.mbstring.php">the mb_* functions</a>, mb_substr and mb_strlen. His benchmarks show that, with a 1500 character string, running his sample script gives him around 61 scans per second. (The PHP6 version with TextIterator works much faster, though - 450 scans per second).
</p>]]></description>
      <pubDate>Thu, 26 Apr 2007 07:01:00 -0500</pubDate>
    </item>
  </channel>
</rss>
