Gerhard: ASP --> PHP: MOD

Beitrag lesen

so ungefähr. bewirkt der operator "%" das gleiche wie die asp-funktion mod?

<%
For i = 1 to 10
    Response.write(i & " mod 5 = " & i mod 5 & "<br>")
Next
%>

This little script will give the following output:

1 mod 5 = 1
2 mod 5 = 2
3 mod 5 = 3
4 mod 5 = 4
5 mod 5 = 0
6 mod 5 = 1
7 mod 5 = 2
8 mod 5 = 3
9 mod 5 = 4
10 mod 5 = 0