How can check variables is null or empty with one function in laravel 8?

5.2k Views Asked by At

I want to check if there is a function in laravel 8 like IsNullOrEmpty for C# to check for empty and null value using just one function.

1

There are 1 best solutions below

1
Shahzaib Anwar Rehmani On BEST ANSWER

you can use empty() PHP function. The empty() function checks whether a variable is empty or not.

This function returns false if the variable exists and is not empty, otherwise it returns true.

The following values evaluates to empty:

  1. 0
  2. 0.0
  3. "0"
  4. ""
  5. FALSE
  6. array()
  7. NULL