user1188621
user1188621

Reputation: 11

How to pagebreak after displaying each 10 keys from an array?

I am using PHP have an array with 100 keys, and I want to echo all the keys, however, I want to add a
after displaying every 10th key: keys 1-10 (0-9), 11-20, 21-30...so on.

Upvotes: 0

Views: 205

Answers (1)

webbiedave
webbiedave

Reputation: 48897

You'll want to use the Modulus operator:

if (!($key % 10)) {
    // page break
}

Upvotes: 2

Related Questions