Undefined offset

itachiidark Messages postés 4 Date d'inscription   Statut Membre Dernière intervention   -  
bobthefox Messages postés 11 Date d'inscription   Statut Membre Dernière intervention   -
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   Statut Membre Dernière intervention   10
 
Essaie un

print_r ($off);


ou

var_dump($off);


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