---
title: "PHP Scripts Collection - General"
description: "Here you can find a collection of ready PHP Scripts that you can use within the extensions as well as anywhere you desire. How to check if current da"
url: "https://www.tassos.gr/docs/common/tutorials/php-scripts-collection"
date: "2026-11-22T14:19:57+00:00"
language: "en-GB"
---

[ Home ](https://www.tassos.gr/docs) / [ General ](https://www.tassos.gr/docs/common) / [ Joomla tutorials ](https://www.tassos.gr/docs/common/tutorials)

#  PHP Scripts Collection

Here you can find a collection of ready PHP Scripts that you can use within the extensions as well as anywhere you desire.

## [How to check if current day of week is Saturday or Sunday](#check_date_is_weekend)

Below you can find a PHP snippet that will allow you to check whether the current day of the week is a weekday.

 ```

use Joomla\CMS\Factory;

// Method that checks whether the current day of week is either Saturday or Sunday using Joomla API
function isWeekend()
{
    // Comma separated list of days to check. Sunday = 7
    $allowDays = array(6,7);

    // Do not edit below
    return in_array(Factory::getDate()->format('N'), $allowDays);
}

// Call method
if (isWeekend())
{
    echo 'Hooray! is weekend!';
}
```

## [How to check if a user has certain cookies stored in their browser](#check_user_browser_cookies)

Below you can find a PHP snippet that will allow you to check if a user has certain cookies stored in their browser.

 ```

use Joomla\CMS\Factory;

// Method that checks if multiple cookies exist using Joomla API
function cookiesExist($cookies)
{
    foreach ($cookies as $cookie)
    {
        if (!$pass = (bool) Factory::getApplication()->input->cookie->get($cookie))
        {
            return false;
        }
    }

    return true;
}

// The cookie names to check
$cookies = [
    'some_cookie_a',
    'some_cookie_b',
    'some_cookie_c'
];

// Check cookies
if (cookiesExist($cookies))
{
    echo 'All cookies exist!';
}
```

 Last updated on Nov 20th 2026 13:11
