Strings In Depth6 / 18
Up next

Index a string

<?php
declare(strict_types=1);
$s = "abc";
// index a string like an array
echo $s[0], $s[2], "\n";
// negative index counts from the end
echo $s[-1], "\n";
What you're solving

read one byte with [i]