2

What's the best way of checking if an object property in php is undefined?

Mohammad Malek
  • 624
  • 1
  • 7
  • 17

1 Answers1

1

You can use is_null Or !isset($object)

Example :

I want to check if the input is undefined. So, I can show errors.

if (!isset($_POST['myInput'])) { echo "error"; } else { // do the code }
Hema D.
  • 140
  • 2
  • 5
  • 17