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"; |
Partager