Though I kinda know how the i++ and j++ work, how exactly do they work like with this
$i = 0; $words[$i]; $i++ $j = 0; $words[$i][$j]; $j++
Also how do you detect which city someone lives in with PHP? Thanks
joeiscoolone wrote:Though I kinda know how the i++ and j++ work, how exactly do they work like with this $i = 0; $words[$i]; $i++ $j = 0; $words[$i][$j]; $j++
This is the same as u would write it like this:
$i = 0; $words[$i++]; $j = 0; $words[$i][$j++];
More about increment and decrement u can find in here: Incrementing/Decrementing Operators
joeiscoolone wrote: Also how do you detect which city someone lives in with PHP? Thanks
U can if u ask him, also u can detect the ip and find in witch country that ip class is ...
joeiscoolone wrote:Though I kinda know how the i++ and j++ work, how exactly do they work like with this $i = 0; $words[$i]; $i++ $j = 0; $words[$i][$j]; $j++ Also how do you detect which city someone lives in with PHP? Thanks
Typically you would use the for operator to loop through stuff.
for($i = 0; $words[$i]; $i++) { // Keep going until $words[$i] is NULL for($j = 0; $words[$i][$j]; $j++) { // Keep going unit the jth element is NULL // Do something with $words[$i][$j] } }
Simply(?) put: $i++ returns the value of $i and then increments $i by one. ++$i increments $i by one and then returns this new value of $i.
Those actually fail with a parse error (because the increment statements don't end with a semicolon). Only ahundiak spotted that they're presumably the control clauses in a for loop (for the behaviour of which, see the [man]for[/man] manual page).