php - There is a way to get all keys of the array? -
I want to get all the keys of the array, comparing each key to a number, something like this:
array ([0] => 7 [1] => 8 [2] => 4 [3] = & gt; 6) If (6! = Aare's Everything) {therefore ...}
does not show this condition because there are [3] => 6 and key 6 = 6 courses.
Is there a function to do this? anything else?
.
foreach ($ array as $ key) = & gt; $ Val) {if (6! = $ Key) {// so ...}}
Example:
$ Array = array (7, 8, 4, 6); Forex currency ($ key as $ key = & gt; $ val) {if (6! = $ Key) {echo '6 is not equal' $ key '& lt; Br / & gt; '; } Else {echo '6 equals' $ key' & lt; Br / & gt; '; }}
Result:
6 equals 7 6 6 is not equal to 6 is not equal to 6 6 is equal to 6 < / Code>
If you want to check that value exists out of 6, <
If (in_array (6, $ array)) {// is present in array 6}
Comments
Post a Comment