Yes, the version that is run is correct, as far as I can tell. It is the default version on the computer.
PHP 7.4.8 (cli) (built: Jul 9 2020 23:43:51) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Xdebug v2.9.6, Copyright (c) 2002-2020, by Derick Rethans
with Zend OPcache v7.4.8, Copyright (c), by Zend Technologies
Running phpinfo also gives the same results through the webserver.
I am at a loss as to how to fix this. My work around solution has been to rewrite the code and use explicit function declaration for the code rather than use the shorthand.
So the code now looks like this:
$ret = usort($list, function ($a, $b) {
return (strtolower($a->name_product) <=> strtolower($b->name_product));
});
It works the same, but is a little more verbose.
If anyone finds a solution to this problem, I would still be interested in finding out and using it. In the meantime, I had to do something else to stop VS Code from making parts of my dev tree Red, it was distracting from real errors.