PHP: Fatal erreur
info3licen
Messages postés
4
Date d'inscription
Statut
Membre
Dernière intervention
-
info3licen Messages postés 4 Date d'inscription Statut Membre Dernière intervention -
info3licen Messages postés 4 Date d'inscription Statut Membre Dernière intervention -
Bonjour,
je travaille avec PHP, et j'ai fais un script pour créer une matrice mais j'ai eu une erreur
Voila mon cript :
Et voila mon erreur
Fatal error: Call to undefined function create_recur_mat() in D:\Foufa\EasyPHP 2.0b1\www\Graphe.php on line 34
Quelqu'un pourrez m'aider?
Merci
je travaille avec PHP, et j'ai fais un script pour créer une matrice mais j'ai eu une erreur
Voila mon cript :
<html>
<Head>
<title> Premiere page </title>
</head>
<body>
<h1 align="center"><u> Les Graphes </u></h1>
<br/>
<br/>
<?php
echo "<font color=\"#800080\">Aujourd'hui nous sommes le : </font>" .date('d/m/Y');
echo "<br><font color=\"#800080\"> Il est :</font> " .date('H \h i \m\i\n s \s\e\c ');
?>
<center>
<form method="post" action="Graphe.php">
Entrez le nombre de Sommet : <input type="text" name="som" />
<br>
<input type="submit" name="ok" value="ok" />
</form>
</center>
<?php
if(isset($_POST['ok']))
{ $n=''; if(isset($_POST['som'])) { $n=($_POST['som'] ); }
//diemension de la matrice
$mat = array();
//1er appel de la fonction
//$mat = matrice
//$n = dimension
//0 = niveau courant
create_recur_mat($mat, $n, 0); La ligne 34
function create_recur_mat($current_mat, $n, $current_n) {
if ($n == $current_n) { //condition de sortie dimension courante = $n
$current_mat = 1; //il ne faut pas oublier la valeur d'initialisation
return; //sortie
}
for ($i = 0; $i < $n; $i++) //pour chaque dimension
//descendre encore d'un cran
create_recur_mat($current_mat[$i], $n, $current_n + 1);
}
print_r($mat);
}
?>
</body>
</html>
Et voila mon erreur
Fatal error: Call to undefined function create_recur_mat() in D:\Foufa\EasyPHP 2.0b1\www\Graphe.php on line 34
Quelqu'un pourrez m'aider?
Merci
A voir également:
- PHP: Fatal erreur
- Easy php - Télécharger - Divers Web & Internet
- Expert php pinterest - Télécharger - Langages
- Retour a la ligne php - Forum Webmastering
- Alert php - Forum PHP
- Retour a la ligne php ✓ - Forum PHP
4 réponses
la fonction doit être définie avant d'être appelée : mets ta fonction create_recur_mat() avant la ligne 34
Merci artragis j'ai fais ce que vous m'avez dit mais j'ai eu dautre erreur :
Notice: Undefined offset: 0 in D:\Foufa\EasyPHP 2.0b1\www\Graphe.php on line 33
Notice: Undefined offset: 1 in D:\Foufa\EasyPHP 2.0b1\www\Graphe.php on line 33
Notice: Undefined offset: 2 in D:\Foufa\EasyPHP 2.0b1\www\Graphe.php on line 33
Array ( )
Comment je fais ?!
Notice: Undefined offset: 0 in D:\Foufa\EasyPHP 2.0b1\www\Graphe.php on line 33
Notice: Undefined offset: 1 in D:\Foufa\EasyPHP 2.0b1\www\Graphe.php on line 33
Notice: Undefined offset: 2 in D:\Foufa\EasyPHP 2.0b1\www\Graphe.php on line 33
Array ( )
Comment je fais ?!
je ne comprends pas pourquoi tu initialise "curent_mat" suffit de vérifier si c'est un array ou un int (is_array() ou is_int())