Where can I find the problem ssid in other groups?
See this problem in other groups
Where is the ssid?
Reply content:
See this problem in other groups
Where is the ssid?
We can echo the output variables in some places, as shown in the following code.
In the results, we can find that,echo $filedStr;This step is not output.
At this time, you should read the official PHP documentation, why is this caused? the reason is the switch.
What is in the official PHP documentation? this is in English and of course Chinese. There is a sentence in it:
Attention if you have mixed types of value in one switch statemet it can make you some trouble
Of course, a solution is provided below:
It is mentioned in this blog that PHP uses dynamic type conversion.
The variable type of a dynamic language changes with the stored variable, that is, the variable type changes according to the specific environment.
When the value of $ value is 'ssid ', when case 0 is executed, it is converted to an integer and compared with it. because it is equal after conversion, it cannot match the subsequent 'ssid '.
Because of yourswitchMatching,caseIs an integer, which causesStringForced conversioninteger,ssidConvertint0, it does not matchcase 'ssid'Of
The ssid is definitely not matched.
Thank you for your answers.
// Only take the integer and floating point types starting with valid numbers and get the first illegal number as of the end... intval ('1234ssid '); // 1234 intval ('ssid'); // 0var_dump ('ssid '= 0); // so, here it is 'true ', the corresponding code segment will be executed. there is no chance to match the ssid again.