PHP Fatal error: Cannot access empty property

If you found this error “Cannot access empty property” when dealing with OOP in PHP the cause of the error most probably because you are using “$” in front of class method.

For example:
$user->$delete($id) // incorrect
$user->delete($id) // correct

Leave a Reply

Your email address will not be published. Required fields are marked *