Skip to main content
Topic: Notice: Trying to access array offset on value of type null  (Read 1807 times) previous topic - next topic

Notice: Trying to access array offset on value of type null

Hello,
I get this: Notice: Trying to access array offset on value of type null
My code is working stand alone!
  but it is not working in PHPRAD!

this is the part of the code that return the notice:
  return isset($_num0[$nmber]) ? $_num0[$nmber] : $_mod10[$nmber] ."надесет";

help, please

Re: Notice: Trying to access array offset on value of type null

Reply #1
@dobsun‍ it is not an issue with phprad but your code. This
Code: [Select]
return isset($_num0[$nmber]) ? $_num0[$nmber] : $_mod10[$nmber] ."надесет";
is wrong, rather this is the right way to do such logic.
Code: [Select]
return isset($_num0[$nmber]) ? $_num0[$nmber] : "надесет";
You cannot be accessing an empty array after checking if it is empty.