quoi qui y a qui cloche t-y donc ?
et je vois s'afficher ceci :Code:
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 function teste_printf($ch,$format, $num, $location){ affiche_variable($ch); $format=$format; $num=$num; $location=$location; eval($ch); echo "<br>\n"; } $num = 5; $location = 'bananier'; $format = 'Il y a %d singes dans le %s'; printf($format, $num, $location); echo "<br>\n"; sprintf($format, $num, $location); echo "<br>\n"; printf($format, $num, $location); echo "<br>\n"; sprintf($format, $num, $location); echo "<br>\n"; $format= 'The %2$s contains %1$04d monkeys'; printf($format, $num, $location); echo "<br>\n"; teste_printf("printf($format, $num, $location);",$format, $num, $location); teste_printf("printf('Il y a %d singes dans le %s', 5, 'arbre');",$format, $num, $location); echo "<br>\n";
Citation:
Il y a 5 singes dans le bananier
Il y a 5 singes dans le bananier
The bananier contains 0005 monkeys
'printf(The %2$s contains %1$04d monkeys, 5, bananier);'
Parse error: syntax error, unexpected T_VARIABLE in C:\Program Files\EasyPHP-5.3.5.0\php\progs_php\essai_chaines_8.php(60) : eval()'d code on line 1
'printf('Il y a %d singes dans le %s', 5, 'arbre');'
Il y a 5 singes dans le arbre