0

I am trying to resolve these errors,

Notice: Undefined offset: 1 on line 230

Notice: Undefined index: on line 231

$righi = file($txt);
foreach($righi as $id => $player){
    list($name, $position) = explode(">", $player);
    $weighted[$weights[trim($position)]] = trim($player);
Community
  • 1
  • 1
Michael
  • 29
  • 1
  • 3

1 Answers1

1

Use isset, for example:

if(isset($weighted[$weights[trim($position)]])){
    // your code
}
RoboNoob
  • 121
  • 4
  • Thank you, but where I need to enter the function that you suggested, I am very very impractical php, be patient, thank you. – Michael Apr 16 '17 at 07:14
  • if(isset($weighted[$weights[trim($position)]])){ $weighted[$weights[trim($position)]] = trim($player); } – RoboNoob Apr 16 '17 at 07:17