Why is using an array with elements $this and 'getFile' causing PHP to only output the word "Array"?

When using an array with elements $this and 'getFile', PHP is treating it as an associative array where the key $this is being cast to a string 'Array'. This is why PHP is only outputting the word "Array". To fix this issue, you can access the elements of the array by their keys or use a different approach to store and access the values.

// Correct way to access elements of the array
$array = [$this, 'getFile'];
echo $array[0]; // Output: value of $this
echo $array[1]; // Output: 'getFile'