Question : php code to check if variable is null
Answered by : yellowed-yak-81il7hyiltej
if(empty($var1)){ echo 'This line is printed, because the $var1 is empty.';
}
Source : | Last Update : Fri, 08 May 20
Question : php check for empty string
Answered by : nate-stringham
if (empty($var)) {
echo '$var is either 0, empty, or not set at all';
}
Source : https://www.php.net/manual/en/function.empty.php | Last Update : Sat, 14 Mar 20
Question : check if array is empty php
Answered by : ivn-javier-londoo-rueda
// Declare an array and initialize it
$non_empty_array = array('apples' => '2');
// Declare an empty array
$empty_array = array();
// Condition to check array is empty or not
if(!empty($non_empty_array)) { echo "Given Array is not empty <br>";
}
if(empty($empty_array)) { echo "Given Array is empty";
}
Source : | Last Update : Sun, 22 Nov 20
Question : php explode empty string
Answered by : johannes-hejslet-jrgensen
array_filter(explode(" ", $string));
Source : https://icefront.info/index.php/2014/12/11/explode-empty-string-returns-one-element-array/ | Last Update : Fri, 01 Jul 22
Question : empty func php
Answered by : worried-wallaby-rr63xxq6sadt
empty($var):bool
//checks if the variable is empty and returns true or false
Source : | Last Update : Wed, 29 Dec 21