If options is used, this function will return a string if not all elements are requested.
Accessing $info['extension']; happens to be accessing the first character of the string array.
Thanks to Tim Cooper's comment. (int)'extension' evaluates to 0. In the documention on the String type in the section "String access and modification by character" outlines how strings can be accessed as arrays, in the note it mentions:
If you pass a second argument to pathinfo, then it doesn't return an array.
You should just echo $info.
From the docs (realpath):
Accessing
$info['extension'];
happens to be accessing the first character of the string array.Thanks to Tim Cooper's comment.
(int)'extension'
evaluates to 0. In the documention on the String type in the section "String access and modification by character" outlines how strings can be accessed as arrays, in the note it mentions: