Probably because that is assuming the cursor in $_POST is located at the beginning of the array.
Per the manual
Every array has an internal pointer to its “current” element, which is initialized to the first element inserted into the array.
However, all of the examples are numerically based index arrays. $_POST is not that type of an array, it is an associative array, and so the first inserted element, doesn’t necessarily mean that element is located at the beginning of the array.
It would be best to use a foreach loop, or to skip the loop altogether and just use print_r or var_dump
Thanks, I started with Java and get confused or don’t know every validators in PHP yet. The validators (the brackets after if, English isn’t my primary language so I’m not always sure if the word I’m typing is the correct one) are much more simple in Java because there are less options with more outcomes if you know what I mean.
is not your best condition to check. If the value is “falsy” (empty string, zero) it will break the loop. That’s likely what was happening to you. foreach() as shown in the previous post would be better.