Unicode PHP functions and files

November 4th, 2009

Warning: This post is 15 years old. Some of this information may be out of date.

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.

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