I'm creating an irc bot and I have an array for Channels ($BotChannels = ['Channel' => [], 'Commands' => [], 'Type' => []];) The bot check on mysql when a new channel is added and when a old channel is removed and when the channel is removed i use a for to catch the channel position but when I use the unset function to remove the channel from array i always get an empty space on array code below.
if(count($BotChannels['Channel']) > 0) {
for($i = 0; $i < count($BotChannels['Channel']); $i++) {
if(!in_array($BotChannels['Channel'][$i], $TempChan)) {
IrcMsg($BotChannels['Channel'][$i], 'Channel removed from database, leaving.');
PartChannel($BotChannels['Channel'][$i]);
unset($BotChannels['Channel'][$i], $BotChannels['Commands'][$i] ,$BotChannels['Type'][$i]);
}
}
unset($TempChan);
}