Skip to end of metadata
Go to start of metadata


<p>This document describes a request for a string helper class within Zend Framework. <br />
The reason I wrote this RFC was based on believing working with strings of different and/or multi-byte character sets in PHP isn't that simple as the build-in string functions supported by PHP.</p>

<h2>Currently used in Zend Framework</h2>

<p>Until now ext/iconv is often used to work with character sets within Zend Framework. But sometimes it's not enough because it isn't installed everywhere. You shouldn't hard require ext/iconv.</p>

<li>There is another extension ext/mbstring that can be used, too.</li>
<li>For working with UTF-8 only the grapheme functions of intl should be enough.</li>
<li>For working with single byte character sets the native build-in function are better than enough.</li>

<h2>What should the utility solve and contain.</h2>

<p>The utility class (or set of classes) should contain methods to work with different character sets like strlen, substr etc. It should contain methods to identify character set byte lengths and it should be as fast as possible because of high frequency method calls.</p>

<p>This should solve the hard requirement of ext/iconv so users can choose the favorite extension for working with different character sets.</p>

<h2>Where should the class live in?</h2>

<p>Because of tons of components working with ext/iconv or ext/mbstring currently the class could live in Zend\Stdlib but Zend\Text or an own namespace could be possible.</p>

<h3>How should it be implemented</h3>

<p>For now did some performance tests how to make a great performance possible.<br />
The fasted is using an adapter for each wrapper class and a static base class for basic methods like "isCharsetSingleByte()". The static class contains a specialized getter to get the best available wrapper for a given character set to work with.</p>

<p>The current implementation is available @ <a class="external-link" href=""></a></p>

string string Delete
utils utils Delete
wrapper wrapper Delete
character-set character-set Delete
multibyte multibyte Delete
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.