I have access to two different servers where I'm running the same code:
<?php
$foo = '#f12345';
if (isset($foo['acf'])) {
echo "acf is set: " . $foo['acf'];
} else {
echo 'acf not set';
}
?>
On one server, running PHP 5.6.21, the result is:
acf is set: f
On the other server, running PHP 5.6.25, the result is:
Warning: Illegal string offset 'acf' in...
I tried but failed to find an explanation online for this behaviour. Would it be a PHP.ini setting?
It seems that, in the server running PHP 5.6.21, the code is being interpreted as a regex search for either a, c, or f (I changed the "f" in $foo to both "a" and "c" and got similar results) and not a search for the index "acf" of an associative array.
Can someone shed some light on why this happens?
Thanks.