Question about "Undefined variable $fID"

Does this:
public function add()
{
$this->set(“fID”, ‘’);
}
satisfy the requirements of PHP 8?
I know it works (in the controller) but I’m wondering if it is acceptable.

It should do, yes.
I’d perhaps set the value to false, rather than an empty string, but it’s achieving a very similar result in that it’s at least initialising $fID.

1 Like