Pourquoi cela ne fonctionne pas? si (array_search ((string) $ key, liste $))foreach array que rechercher dans un autre tableau
foreach ($head as $index => $key)
{
if (array_search((string)$key,$list))
{
$data[$index] = serialize($data[$index]);
$combined[$key] = isset($data[$index]) ? $data[$index] : null;
} else {
$combined[$key] = isset($data[$index]) ? $data[$index] : null;
}
}
liste $ est un tableau de recherche dans
Et ce qui se passe? qu'est-ce qui ne fonctionne pas? –
cela ne fonctionne pas: if (array_search ((chaîne) $ key, $ list)) – user419503
Juste une note, array_search renverra la clé de l'élément correspondant, si l'élément correspondant est à la touche 0, alors votre va évaluer c'est faux et sauter dans l'autre. –