Tutorial by Examples

Single characters can be extracted using array (square brace) syntax as well as curly brace syntax. These two syntaxes will only return a single character from the string. If more than one character is needed, a function will be required, i.e.- substr Strings, like everything in PHP, are 0-indexed....
You can also use interpolation to interpolate (insert) a variable within a string. Interpolation works in double quoted strings and the heredoc syntax only. $name = 'Joel'; // $name will be replaced with `Joel` echo "<p>Hello $name, Nice to see you.</p>"; # ...

Page 1 of 1