PHP strings tip
7th August 2002
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.
More recent articles
- What happens if AI labs train for pelicans riding bicycles? - 13th November 2025
- Reverse engineering Codex CLI to get GPT-5-Codex-Mini to draw me a pelican - 9th November 2025
- Video + notes on upgrading a Datasette plugin for the latest 1.0 alpha, with help from uv and OpenAI Codex CLI - 6th November 2025