How should I understand the {code...} line of code in the loadClass () method in the implementation of the PSR-4 instance class? I think it should be: {code ...} the problem has been solved: see 'notice 'in the PHP operator priority Manual: although the priority is lower than that of most other operators, PHP still... implementation of PSR-4 instance class
loadClass()
Method
while (false !== $pos = strrpos($prefix, '\\'))
How should this line of code be understood?
I think it should be:
while (false !== ($pos = strrpos($prefix, '\\')))
The problem has been solved:
See 'notice 'in the PHP operator priority manual ':Although = has a lower priority than most other operators, PHP still allows expressions similar to the following: if (! $ A = foo (). In this example, the return value of foo () is assigned to $.
How to force PHP to comply with the Conventions?
Reply content:
Implementation of PSR-4 instance classloadClass()
Method
while (false !== $pos = strrpos($prefix, '\\'))
How should this line of code be understood?
I think it should be:
while (false !== ($pos = strrpos($prefix, '\\')))
The problem has been solved:
See 'notice 'in the PHP operator priority manual ':Although = has a lower priority than most other operators, PHP still allows expressions similar to the following: if (! $ A = foo (). In this example, the return value of foo () is assigned to $.
How to force PHP to comply with the Conventions?
That's what you understand.
The priority of the value assignment operator is higher than that of the comparison operator. Therefore, the value assignment operation is performed first.
The Return Value of the value assignment operator is the right value of the operator.
Update:
The priority of the value assignment operator is lower than that of the comparison operator, but PHP has special syntax skills:
Note: Although = has a lower priority than most other operators, PHP still allows expressions similar to the following: if (! $ A = foo (). In this example, the return value of foo () is assigned to $.