Explication de...(php)
Résolu1 réponse
-
ModérateurAl même chose qu'en C ;)
http://php.easynet.be/manual/fr/function.sprintf.php
exemples<?php $st1 = "Hello World"; $pi = 3.1415; $st = sprintf("The string is %s\n", $st1); print $st; $st = sprintf("The string is %25s\n", $st1); print $st; $st = sprintf("The string is %'b25s\n", $st1); print $st; $st = sprintf("The float is %.7f\n", $pi); print $st; $st = sprintf("The float is %10.4f\n", $pi); print $st; $st = sprintf("The float is %08f", $pi); print $st; ?> johand@horus:~/src/php$ php sprintf.php The string is Hello World The string is Hello World The string is bbbbbbbbbbbbbbHello World The float is 3.1415000 The float is 3.1415 The float is 3.141500
Johan