Skip to end of metadata
Go to start of metadata
You are viewing an old version of this page. View the current version. Compare with Current  |   View Page History


This document describes a request for a string helper class within Zend Framework.
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.

Currently used in Zend Framework

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.
There is another extension ext/mbstring that can be used, too. As Fallback build-in functions can be used to handle single byte character sets.

What should the utility solve and contain.

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.

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

Where should the class live in?

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.

How should it be implemented

For now did some performance tests how to make a great performance possible.
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.

The current implementation is available @

Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.