P
P
penexe2013-04-12 18:41:34
PHP
penexe, 2013-04-12 18:41:34

Help me choose a condition

It is necessary to get such an output of information:
image

Tell me the condition for displaying a small picture, only the number of the news is known.
Note that this is not a simple alternation) the picture is displayed in 2.3 ... 6.7 ... 10.11

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
ertaquo, 2013-04-12
@penexe

if ($index % 2 == 0) $align = 'right'; else $align = 'left';

More briefly:
$align = $index % 2 ? 'left' : 'right';

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question