Ik ben een pagina aan het maken waarin een aantal DIV layers at random onder elkaar worden weergeven.
Er is een array waarin alle layers staan. Deze worden geshuffeld.
Maar van de 5 layers, wil ik er maar 3 echo'en. Het probleem is dat hij toch de hele array laat zien. Wat gaat er mis?
Stukje code:
Er is een array waarin alle layers staan. Deze worden geshuffeld.
Maar van de 5 layers, wil ik er maar 3 echo'en. Het probleem is dat hij toch de hele array laat zien. Wat gaat er mis?
Stukje code:
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
| <?php $content = array( '<div style=" height: 10px; width:100px; background-color:#0FC">START</div><br>', '<div style=" height: 10px; width:100px; background-color:#0FC">ABOUT</div><br>', '<div style=" height: 10px; width:100px; background-color:#0FC">WORK</div><br>', '<div style=" height: 10px; width:100px; background-color:#0FC">CONTACT</div><br>', '<div style=" height: 10px; width:100px; background-color:#0FC">BLOG</div><br>' ); shuffle($content); foreach ($content as $value) $count = count($value); //telt het aantal div layers else $count = 3; for ($i = 0; $i < $count; $i ++) { $explode = explode('|', $value); echo '' . $explode[0] . ''; } ?> |
nikszolekkeralss.exe