News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Elizabeth Smith's Blog:
String Class (Kal_String)
February 01, 2006 @ 06:48:47

On her blog today, Elizabeth Smith has this new post highlighting a string class that she's created to overload the basic PHP types to handle multibyte or translated strings.

So my rather cumbersome three classes to handle translation and charsets is now ONE class. When the rest of the magic __toString stuff goes into php (estimated for 5.2, which I wouldn't know if I didn't read internals religiously) it makes it even easier to use.

Kal_String is the class itself. Basically it has TWO constructors - because there are a series of static settings and two static methods that deal with things like a default charset to use for all strings and a default language to look for. The language searching is set up with a callback - so you can write your own class using gettext or including straight php files or whatever you want. You can even manually load in translation strings for individual string instances if you're so inclined.

She gives examples of how to use the class, everything from just a simple output to the use of some of the more advanced "interpretation"-based features.

0 comments voice your opinion now!
string class simple output interpret multibyte overload string class simple output interpret multibyte overload


blog comments powered by Disqus

Similar Posts

AlternateInterior.com: Communicating with threads in PHP

Dagfinn Reiersol's Blog: Real programming with PHP 5.3 (part 2): JavaScript-style classes

DevShed: Throwing Basic Exceptions When Auto Loading Classes in PHP 5

Christian Stocker's Blog: FOTD: REFLECTIONCLASS()->NEWINSTANCEARGS($ARGS) is "slow"

Richard Heyes' Blog: Browser Detection


Community Events





Don't see your event here?
Let us know!


interview wordpress code symfony list release configure laravel language api install introduction community threedevsandamaybe developer series application bugfix podcast library

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework