Check if string is empty

empty() function

$str = '';
if (empty($str)) {
    echo "The string is empty";
} else {
    echo "The string is not empty";
}

Direct comparison

$str = '';
if ($str === '') {
    echo "The string is empty";
} else {
    echo "The string is not empty";
}

Check if array key exists or not

array_key_exists() function

$array = array(
    "key1" => "value1",
    "key2" => "value2",
    "key3" => "value3"
);

$keyToCheck = "key2";

if (array_key_exists($keyToCheck, $array)) {
    echo "The key '$keyToCheck' exists in the array.";
} else {
    echo "The key '$keyToCheck' does not exist in the array.";
}

Check if an array is empty or not

empty() function

$arr = array();
if (empty($arr)) {
    echo "The array is empty";
} else {
    echo "The array is not empty";
}

count() function

$arr = array();
if (count($arr) == 0) {
    echo "The array is empty";
} else {
    echo "The array is not empty";
}

sizeof() function

$arr = array();
if (sizeof($arr) == 0) {
    echo "The array is empty";
} else {
    echo "The array is not empty";
}

Add space

margins

<!DOCTYPE html>
<html>
<head>
    <title>Spacing Example</title>
    <style>
        .spacer {
            margin-bottom: 20px;
        }
    </style>
</head>
<body>

<div class="spacer"></div>
<p>This is a paragraph with some space below it.</p>

</body>
</html>

padding

<!DOCTYPE html>
<html>
<head>
    <title>Spacing Example</title>
    <style>
        p {
            padding-bottom: 20px;
        }
    </style>
</head>
<body>

<p>This is a paragraph with some space below it.</p>

</body>
</html>

Add favicon

<!DOCTYPE html>
<html>
<head>
    <title>Page Title</title>
    <link rel="icon" href="favicon.ico" type="image/x-icon">
</head>
<body>

<!-- Your HTML content here -->

</body>
</html>

Add css

<style>

<!DOCTYPE html>
<html>
<head>
    <title>CSS Example</title>
    <style>
        body {
            background-color: #f0f0f0;
            font-family: Arial, sans-serif;
        }
        h1 {
            color: blue;
        }
        p {
            font-size: 16px;
        }
    </style>
</head>
<body>

<!-- Your HTML content here -->

</body>
</html>

external CSS file

<!DOCTYPE html>
<html>
<head>
    <title>CSS Example</title>
    <link rel="stylesheet" type="text/css" href="styles.css">
</head>
<body>

<!-- Your HTML content here -->

</body>
</html>

Add video

<!DOCTYPE html>
<html>
<head>
    <title>Video Example</title>
</head>
<body>

<video width="640" height="360" controls>
  <source src="path_to_your_video.mp4" type="video/mp4">
  Your browser does not support the video tag.
</video>

</body>
</html>

Add a background image

<!DOCTYPE html>
<html>
<head>
    <title>Background Image Example</title>
    <style>
        body {
            background-image: url("path_to_your_image.jpg");
            background-size: cover;
        }
    </style>
</head>
<body>

<!-- Your content here -->

</body>
</html>