[Solved] Undefined offset notice in a line that doesn’t access an array value [closed]


In order for you to successfully extract an array of 5 elements like you tried via “list”, you need to make sure the performAllUpdates function returns an array of 5 elements minimum. For example, the following return statement in the function will work:

return array($response1,$response2,$response3,$response4,$response5);

But of course $response1 through $response5 need to be replaced with actual values or variables used in the function.

I also recommend modifying the function to return the array always, and if the function is meant to produce an error based on invalid input, then put in invalid values for the array. For example, you can use this return statement to show an error:

return array(-1,-1,-1,-1,-1);

That way, your attempt to receive 5 elements will always be successful and then you can test the results by checking the values of any of the 5 variables you asked for from the function.

solved Undefined offset notice in a line that doesn’t access an array value [closed]