Menu

Err Message: Undefined Index

Help
James Cook
2003-12-30
2004-01-01
  • James Cook

    James Cook - 2003-12-30

    $oplist='';
    foreach ($irc->channel[$data->channel]->ops as $key => $value) {
    $oplist .= ' '.$key;
    }

    Also if you insert '#channel'..same error.

    PHP Warning:  Invalid argument supplied for foreach() in
    C:\php\example.php on line 36

     
    • Mirco Bauer

      Mirco Bauer - 2004-01-01

      did you setChannelSync(true); ?

      if so, use code with more error handling like:
      if (isset($irc->channel[strtolower($data->channel)]) {
        foreach ($irc->channel[strtolower($data->channel)]->ops as $key => $value) {
          and so on...
        }
      }
      the strtolower is very important! the whole array is case sentive and all channels there are lower cased! (because of uniqueness)

       

Log in to post a comment.