Récuperer variable dans fonction php

Résolu
seb911 Messages postés 22 Statut Membre -  
seb911 Messages postés 22 Statut Membre -
Bonjour,

j'ai actuellement un problème pour récupérer la valeur d'une variable dans une fonction :

Voici la fonction :

function calchash($alltorrent)
{
$hash = @sha1(BEncode($array["info"]));
$hash_maj = strtoupper($hash);
echo "<input type='hidden' name='hash' value='$hash_maj'>";
}

et je voudrais, dans la suite de ma page, récupérer la variable $hash_maj

Mais même en la déclarant en global, sa marche po

Merci d'avance.

2 réponses

Mimiste Messages postés 1159 Statut Membre 206
 
Salut

Ben avec un truc du genre :

function calchash($alltorrent)
{
$hash = @sha1(BEncode($array["info"]));
$hash_maj = strtoupper($hash);
echo "<input type='hidden' name='hash' value='$hash_maj'>";
return $hash_maj;
}

et tu appelle ta fonction :

$hash_maj = calchash($truc);
0
seb911 Messages postés 22 Statut Membre
 
Nikel! Sa marche!

Merci
0