Appel d'une fonction dand une autre fonction
Alak
Messages postés
35
Statut
Membre
-
Alak Messages postés 35 Statut Membre -
Alak Messages postés 35 Statut Membre -
Bonjour,
J'ai des problèmes de fonction "non definie"
en gros j'ai un fichier fonction.php
contenant :
fonction noobteam (parametre1, parametre2){
blaa blaaa
}
qui renvois true ou false
et mon :
index.php
include_once(' fonction.php');
fonction kikoolol (truc1, truc2){
if ( noobteam (parametre1, parametre2) == True) {
blablabl et rebla
}
else{
loldodododo
}
Il me met une erreur quand je lance l'index.php et que appel la fonction kikoolol.
undefinited fonction noobteam un truc dans le genre.
Je suppose c'est parceque ma fonction noobteam est pas "global" ou un truc dans le genre.
quelqu'un aurai une idée de la marche a suivre?
Merci d'avance
J'ai des problèmes de fonction "non definie"
en gros j'ai un fichier fonction.php
contenant :
fonction noobteam (parametre1, parametre2){
blaa blaaa
}
qui renvois true ou false
et mon :
index.php
include_once(' fonction.php');
fonction kikoolol (truc1, truc2){
if ( noobteam (parametre1, parametre2) == True) {
blablabl et rebla
}
else{
loldodododo
}
Il me met une erreur quand je lance l'index.php et que appel la fonction kikoolol.
undefinited fonction noobteam un truc dans le genre.
Je suppose c'est parceque ma fonction noobteam est pas "global" ou un truc dans le genre.
quelqu'un aurai une idée de la marche a suivre?
Merci d'avance
A voir également:
- Appel d'une fonction dand une autre fonction
- Fonction si et - Guide
- Nommez une application d'appel vidéo ou de visioconférence - Guide
- Appel privé - Guide
- Fonction remplacer sur word - Guide
- Fonction somme excel - Guide
4 réponses
Bjr
C'est assez simple en php et il n'y a pas besoin de déclarer une fonction en global.
index.php
fonction.php
C'est assez simple en php et il n'y a pas besoin de déclarer une fonction en global.
index.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> </head> <body> <?php include_once('fonction.php'); function kikoolol($truc1, $truc2) { if (!notebeam($truc1,$truc2)) { echo "false"; } } kikoolol("Demo", "Test"); ?> </body> </html>
fonction.php
<?php
function notebeam($truc1, $truc2)
{
echo "<pre>";
var_dump($truc1);
var_dump($truc2);
echo "</pre>";
return true;
}
?>