Undefined offset

Fermé
itachiidark Messages postés 4 Date d'inscription dimanche 16 juin 2013 Statut Membre Dernière intervention 24 juillet 2014 - 28 août 2013 à 17:19
bobthefox Messages postés 11 Date d'inscription mercredi 13 octobre 2004 Statut Membre Dernière intervention 31 août 2013 - 28 août 2013 à 19:24
function parseResponse($str)
{
$str = nl2br($str);
$str = str_replace("<br />","",$str);
$str = preg_replace("/<script[^>]*?>.*?<\/script>/si","", $str);
$off = array();
$matches = preg_match_all("/<table[^>]*?>.*?<\/table>/si", $str, $off,PREG_PATTERN_ORDER);
$strVal = $off[0][6];//je reçois ici :Notice: Undefined offset: 6

return $strVal;

}


que dois-je faire pour corriger ce code svp ?

1 réponse

bobthefox Messages postés 11 Date d'inscription mercredi 13 octobre 2004 Statut Membre Dernière intervention 31 août 2013 10
28 août 2013 à 19:24
Essaie un

print_r ($off);


ou

var_dump($off);


pour déboguer...
(l'erreur signifie que $off[0][6] n'existe pas)
--
1