1
2<?php
3// Get the first character of a string
4$str = 'This is a test.';
5$first = $str[0];
6
7// Get the third character of a string
8$third = $str[2];
9
10// Get the last character of a string.
11$str = 'This is still a test.';
12$last = $str[strlen($str)-1];
13
14// Modify the last character of a string
15$str = 'Look at the sea';
16$str[strlen($str)-1] = 'e';
17
18?>
19
20