Debugging legacy code and I have a strange issue. The legacy code is being moved to PHP 7.2. I don't know which version of PHP it was originally written for but it does work in PHP 5.6.
Below is my example of the problem...
$variable = '';
$variable['key'] = 'Hello World!';
echo $variable['key'] // H
When I echo $variable['key'] it only gets the first character from the value. I know now that it is because $variable is initially declared as a string.
But why does this work in PHP 5.6? What can I do to make this work in 7.2 without trawling through thousands of lines of code?
Is there a directive like strict_types I can use?