array empty check in php
if (empty($array)) {
// list is empty.
}//To clear array you are able to simply re-instantiate it
$foo = array();
//To clear $foo from the symbol table use
unset($foo);// 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";
}
Also in PHP:
- base 64 decode p[hp
- console print in php
- decrypt base64 php
- check if string matches php
- by default null eloquent user data in relationship in laravel 8
- delete all post and attachments of a user delete codegrapper
- datetime to timestamp in php
- codeigniter 3 smtp email send
- adding days to data php
- clear storage laravel
- array_key_exists not finding numbers
- 500 internal server error php laravel
- debuggin native php
- create php laravel project
- echo gettype
- check array has key php
- auto generated password in php
- date method in php
- create random password in php
- echo all php errpr
- create controller in laravel command line
- catching errors in php
- Customer::insert([ 'customer_name' => $request->customer name, 'customer mobile'=> $request->customer mobile, 'user_id'=>Auth::user()->id, 'created_at'=> Carbon::now() ]);
- check method in laravel