How does php determine that array elements are not spaces
This article mainly introduces php how to judge the array elements are not spaces, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor with you to understand.
Determine the array element is not a space method: 1, use the "foreach ($arr as $value) {}" statement to traverse the array; 2, use the "if ($valuevalues =") "statement to determine whether the array element is a space; 3, if the array element is not empty, then the output" array element is not a space ".
Operating environment of this tutorial: windows7 system, PHP7.1 version, DELL G3 computer
Php determines that array elements cannot be spaces.
Train of thought:
Use the foreach statement to iterate through the array, assigning the key value of the current array to $value in each loop
In the body of the loop, if statement is used to determine whether the array element is a space.
If it is not a space, then $iSpac +
If it is a space, set $iTune0 and use break; to exit the entire loop.
If statement is used to determine whether the value of $I is 0, you can know whether there are space elements in the array.
Implementation code:
Thank you for reading this article carefully. I hope the article "how to determine that an array element is not a space" shared by the editor will be helpful to everyone. At the same time, I also hope that you will support and follow the industry information channel. More related knowledge is waiting for you to learn!