PHP undefined index error

Please help me again! I have problems with this code:

<?php
  $pathThemes = INC_DIR . "themes";
  $d = dir($pathThemes);
  while (false !== ($entry = $d->read())) {
    $fileInfo = pathinfo($pathThemes . '/' . $entry);

    if ('php' == $fileInfo['extension']) {
      include_once($pathThemes . '/' . $entry);
      $name = $fileInfo['filename'];
      if (!$GLOBALS['fc_config']['themes'][$name]['name']) {
        unset($GLOBALS['fc_config']['themes'][$name]);
      }
    }
  }
?>

      

He tells me:

Note: Undefined index: name in C: \ wamp \ www \ FlashChat_v607 \ chat \ inc \ include_themes.php on line 10

Note: Undefined index: name in C: \ wamp \ www \ FlashChat_v607 \ chat \ inc \ include_themes.php on line 10

Note: Undefined index: name in C: \ wamp \ www \ FlashChat_v607 \ chat \ inc \ include_themes.php on line 10

Note: Undefined index: name in C: \ wamp \ www \ FlashChat_v607 \ chat \ inc \ include_themes.php on line 10

+2


a source to share


3 answers


try using isset ($ GLOBALS ['fc_config'] ['themes'] [$ name] ['name']) with



+2


a source


if (!isset($GLOBALS['fc_config']['themes'][$name]['name'])) {

      



take a look at the isset

function

+2


a source


Try the following:

  if (!empty($name) && isset($GLOBALS['fc_config']['themes'][$name]['name'])) {
    unset($GLOBALS['fc_config']['themes'][$name]);
  }

      

+1


a source







All Articles