Simon Willison’s Weblog


Wednesday, 7th August 2002

PHP strings tip

PHP Tip: You can access characters within a PHP string using the index of the caracter in curly braces after the variable name. For example, $string{0} returns the first character, $string{3} returns the fourth character and $string{strlen($string)-1} returns the last character. You can assign to individual characters of a string in the same way, so $string{0} = strtoupper($string{0}); will convert the first character of a string to upper case. For more tips on working with strings see the PHP manual and Zend’s useful strings tutorial.

[... 94 words]

Smarty 2.30

Smarty 2.3.0 is out, and includes a useful new debugging function and support for assigning template variables by reference. I get a mention in the CHANGELOG for a small bug fix I submitted. Open source at work.

[... 44 words]

Funky stuff for css-discuss

I think I’ve kept quiet for long enough, so here are some details of the two projects I have alluded to. The first is a database driven mailing list archive for css-discuss. It has just gone in to private beta, so anyone subscribed to the css-discuss list should have an email with the URL, username and password requried to try it out. It has a pretty usable search engine and does some nice threaded views in messages—more importantly, it now contains all 9,000+ messages sent to css-discuss since it launched back in January 2002 (imported from the static Mailman archives). I’ve spent many hours surfing through the archives already and they are a wealth of useful CSS information.

[... 161 words]

XHTML 2 demonstrated

Sjoerd Visscher has published an XHTML 2.0 page that works in IE6, Mozilla and Opera, complete with support for navigation lists and href attributes on multiple elements. The implementation is very clever—it uses IE behaviors, Mozilla XBL files and Opera’s proprietary link CSS properties to get all three browsers to play nicely (be sure to check out the style sheet). A custom DOCTYPE at the top of the page adds DTD descriptions of the new XHTML 2.0 elements used in the document.

[... 110 words]

2002 » August