Passer -1 à une fonction
Posté : 07 nov. 2011, 17:57
Bonjour,
J'ai un problème : J'essaye de passer -1 a une fonction, mais j'ai l'impression que ca ne fonctionne pas.
Pouvez vous m'aider ?
J'ai un problème : J'essaye de passer -1 a une fonction, mais j'ai l'impression que ca ne fonctionne pas.
Pouvez vous m'aider ?
$arborescence_log = 0;
function log_it($txt, $a) {
$a=intval($a);
$logFileName = "LOG.txt";
$fh = fopen($logFileName, 'a+');
global $arborescence_log;
if ($a < 0)
$arborescence_log=$arborescence_log+$a;
for ($n = 0; $n < $arborescence_log; $n++)
fwrite($fh, "|\t");
fwrite($fh, $txt . "\n");
if ($a > 0)
$arborescence_log=$arborescence_log+$a;
fclose($fh);
}
log_it("=== SERVEUR.PHP ===", 1);
/*[...]*/
log_it("=== FIN SERVEUR.PHP ===", -1);
Donne :
=== SERVEUR.PHP ===
| === FIN SERVEUR.PHP ===