Source Code:
(back to article)
<?php // Define a string variable $string = 'abc'; // Cast the string to an array $string_array = (array) $string; // Access the first character of the first element in the array // The first index [0] accesses the first element of the array, which is a string "abc" // The second index [0] accesses the first character of the string, which is "a" echo $string_array[0][0]; // prints "a"
Result:
Report an issue