Explication de...(php)

Résolu
maxime_B Messages postés 788 Date d'inscription   Statut Membre Dernière intervention   -  
jisisv Messages postés 3645 Date d'inscription   Statut Modérateur Dernière intervention   -
bonjour

ça veut dire quoi et ça sert à quoi

sprintf()


en php??

merci devos réponses

1 réponse

jisisv Messages postés 3645 Date d'inscription   Statut Modérateur Dernière intervention   934
 
Al 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
-1