What common mistake can lead to the error "Uninitialized string offset" when trying to manipulate arrays in PHP?
The common mistake that can lead to the error "Uninitialized string offset" is trying to access an index of a string as if it were an array. This error occurs when trying to treat a string as an array by using square brackets to access individual characters. To solve this issue, make sure to use string functions like substr() or mb_substr() to manipulate strings instead of treating them as arrays.
$string = "Hello World";
$firstCharacter = substr($string, 0, 1);
echo $firstCharacter; // Output: H