2 divs in while loop!

Started on the old forum in July 2011 · view the original in the archive · old links redirect here

7 replies · 1,051 views · started 15 years ago · 1 min read

6 participants
atef Developer · 224 posts #4

well i found it at another site so im decided to share it..

<?php
for($i=0;$i<5;$i++) {
$post_bg = ($bg++%2 == 0) ? "black" : "white";
echo "<div style='background-color: $post_bg'>text</div>";
}
?>

this printing text with black bg text with white bg if u will use it at while loop replace $i<5 to $i<1 😉

Wapito Newbie · 8 posts #5

$i=0; while(true) { if($i%2==0) { echo ''; } else { echo ''; } $i++; }

pichiriche Junior · 38 posts #6

Use array brot

Added after 6 minutes:

This is easy

if($css=="css1") { $css=="css2"; }else{ $css=="css1"; }

in the sql result

echo ""; echo "wathever "; echo "";

Mysterio Lead · 630 posts #7

There are unlimited choises for this where many of them are posted here, so just copy one that you like, Atef.

mysterio.al - programming is a functional art

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close