• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 260
  • Last Modified:

Don't understand this conditional statement..

in a WP plug-in

if ( $gallery->columns > 0 && ++$i % $gallery->columns == 0 )

I don't understand the syntax...
0
chrisfixit
Asked:
chrisfixit
1 Solution
 
svgmucCommented:
If the amount of columns in the gallery is greater than 0 and a counter $i that is being increased by one before the calculation is dividable by the amount of columns with no modulo...
0
 
owner66Commented:
It says if the result of the comparison of ($gallery-> columns greater than zero AND the (modulus of incremented $i divided by $gallery->columns)) is equal to zero
0
 
hernst42Commented:

$gallery->columns > 0
colums is greater than 0


++$i % $gallery->columns == 0
((increased loopcounter $i by one ) modulo the columns) is zero

typical means to make a column break if the number of elments in the row has reached the number of columns to display
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now