No, it’s not ok – you should define the variables you use. If it’s not defined, it might be defined by, say, some other php script (assuming you have multiple in use, which is a common case).
The way to clear up the error is to define variables used.
2
solved error_reporting(E_ALL); Says $key undefined