@raphael_tillman
In Laravel, you can check if a variable is empty using the empty
function or the isset
function.
Using empty
function:
1 2 3 4 5 6 7 |
if(empty($variable)) { // variable is empty echo "Variable is empty"; } else { // variable is not empty echo "Variable is not empty"; } |
Using isset
function:
1 2 3 4 5 6 7 |
if(isset($variable)) { // variable is not empty echo "Variable is not empty"; } else { // variable is empty echo "Variable is empty"; } |
You can use either of these methods to determine if a variable is empty or not in Laravel.