Bonjour/Bonsoir
j’essaie de mettre en place un incrémentation mais ça ne fonctionne pas
voici mon code :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64 $rand_off = rand(1,6) ; $h5 = rand(0,3) ; for($i = $cons_datdeb ; $i <= $cons_datfin ; $i->modify('+1 day')){ $idt = $i->format("d-m-Y") ; $ijs = $i->format("N") ; $isem = $i->format('W') ; if( $ijs !== '7' and $ijs !== ''. $rand_off . '' ){ $tab_hdm = array( 0 => "7:00:00" , 1 => "8:00:00" , 2 => "9:00:00" , 3 => "10:00:00" , ) ; $random_key = rand(0,3) ; $hdm = $tab_hdm[$random_key] ; $k = 0 ; if( $hdm == $tab_hdm[3] ){ echo '<p style="background:#00FF33" > 10h pour : '. $idt .' compteur : ' . ++$k .' </p>' ; } }
le souci est que k est tours égal à 1 au lieu de 2 , 3 ... :
comment faire pour que ça fonctionne ?
NB :
en faite cela fonctionne si je fais :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12 //avec le $$k ou ++${$k} $k = 0 ; if( $hdm == $tab_hdm[3] ){ echo '<p style="background:#00FF33" > 10h pour : '. $idt .' compteur : ' . ++$$k .' </p>' ; }
mais j'ai un message d'erreur :
Partager