PHP code example of chinleung / php-weekday

1. Go to this page and download the library: Download chinleung/php-weekday library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

chinleung / php-weekday example snippets

bash
composer 
 php
Weekday::getNameFromValue(0, 'en'); // Sunday
(new Weekday(0, 'en'))->getName(); // Sunday
 php
Weekday::getNameFromValue(0, 'fr'); // Dimanche
(new Weekday(0, 'en'))->getName('fr'); // Dimanche
 php
Weekday::getValueFromName('Sunday', 'en'); // 0
Weekday::getValueFromName('Lundi', 'fr'); // 1
(new Weekday('wednesday', 'en'))->getName(); // 3
 php
Weekday::getNames('en'); // ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']
 php
(new Weekday(1, 'en'))->setLocale('fr')->getName(); // Lundi