0

I just was reading a snippet of code with this line:

private static ?array $labels = null;

all is clear for me, except the question mark before the array datatype. Can you, please, explain me the presence of this little ? thing here?

TIA

jdrsantos
  • 3
  • 1
  • See also [question marks before type declaration in PHP7](https://stackoverflow.com/q/48450739/9193372) – Syscall Feb 18 '22 at 16:48

1 Answers1

2

It means that the variable $labels is allowed to be null as well as an array.

Daan
  • 12,099
  • 6
  • 34
  • 51
  • Ah, ok, I think I got it. It means I declared it an array, but exceptionally it can be **null** too. Thank you, Daan. – jdrsantos Sep 07 '21 at 13:38