Dynamic Flash

Confessions of a serial code abuser
  • rss
  • Home
  • MTASC
  • Archives
  • About me
  • Goodies
    • Base64 encoder/decoder class
  • My Bookshelf
  • My Talks

PHP, preg_split() and utf-8

Sunday, 20 November 2005

This is just a quickie for anyone who's battling with the UTF-8 support (or lack thereof) in PHP4.

According to the online docs the PCRE family of functions can be made UTF-8 aware by adding a u modifier to the pattern you're using. Since the standard explode function doesn't support UTF-8, you might think of using the preg_split function like this to split a UTF-8 string into an array of characters:

PLAIN TEXT
PHP:
  1. $characters = preg_split('//u', $source);

Unfortunately it seems that preg_split is the only PCRE function that doesn't support the u modifier. Instead, you'll have to use preg_match_all like this to get the same effect:

PLAIN TEXT
PHP:
  1. preg_match_all('/./u', $source, $matches);
  2. $characters = $matches[0];

Comments
2 Comments »
Categories
PHP
Comments rss Comments rss
Trackback Trackback

phpforflash.com no more

Sunday, 04 September 2005

It looks as though the hosting for phpforflash.com has finally run out. This was the official site for my Foundation PHP for Flash and Advanced PHP for Flash books. It even had an active community, almost 4 years after the original book was published. Thanks to Alan McCann, Content Architect for both books, for picking up the hosting tab for as long as he has.

Incidentally, in an effort to get rid of a lot of clutter from our dinky little house I've put two of my author copies of Foundation PHP for Flash on Amazon UK. The book is out of print now (and, if I'm honest, a little out of date in places) so this is pretty much the only way to get hold of a copy now. I'll even sign them too if that would help to shift them, though I'm not egotistical enough to think that anyone would want my autograph for any purpose other than forging cheques in my name ;)

Comments
8 Comments »
Categories
Flash, PHP
Comments rss Comments rss
Trackback Trackback

About Dynamic Flash

Steve Webster is a Senior Web Developer for Yahoo! in London, UK.

He is more than a little concerned that he defines himself in terms of his career, and that he talks about himself in the third person.

Find out more

Recent Posts

  • Read and write local files with Flash Player 10
  • The problem with SproutCore
  • Yahoo! London seeks Junior Developers
  • I am Singularity
  • Yahoo! Astra component library 1.1 released

Tags

Accessibility ActionScript actionscript3 actionscript 3.0 air apple astro book conference designer filereference file upload Flash flex framework internet internet explorer JavaScript jobs junior microsoft opportunities ria singularity08 skin tutorial urlrequest web developer web development Web Standards Yahoo!

del.icio.us-ed

Stuff

Singularity?
Flex.org - The Directory for Flex
rss Comments rss valid xhtml 1.1 design by jide powered by Wordpress get firefox