Home / Programming / PHP / Unicode math symbols as operators in PHP6?

Unicode math symbols as operators in PHP6?

Noted over on Sara Golemon’s blog today. Can we expect this sort of thing to be in future PHP code?

var_dump(¼, ½ ¾);
// float(0.25)
// float(0.5)
// float(0.75)

var_dump(1 ≤ 2, 2 ≯ 3, 5 ≠ 6);
// bool(true)
// bool(true)
// bool(true)

var_dump(3 × 4, 15 ÷ 5);
// int(12)
// int(3)

var_dump(1 « 3);
// int(8)

/* Your font may be too small,
 * but that's a skull and crossbones */
☠('aka die/exit');

Well, no, not really – she implemented it just for fun, but it’s an interesting idea, and face it – who doesn’t want to be able to use all the keys on the Space Cadet Keyboard?

Space Kadet keyboard

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.