Unicode PHP functions and files


Posted by Andrew McCombe on Wed Nov 4, 2009

This is nothing amazing, just a bit of fun.  One of the more useful features of the upcoming PHP6 is full unicode support throughout.  However, did you know that PHP supports unicode already and can be used for variable, method and function names?

vim ☹.php

< ?php

function ☹() {
 echo "\nWe are NOT at all happy!\n";   
}

☹();
?>

Run this at command line:

$ php ☹.php 

We are NOT at all happy!

…and in a web browser:

http://localhost/☹.php

Not sure if this would work on a Windows OS.

ps. To get the sad face on linux (Gnome/Ubuntu), hold down CTRL and Shift, press u and then 2639.