INVP::weekdays( int $zero_through_six = null )
If no parameter is provided, returns an array containing lowercase weekdays as keys and title case, three-letter abbreviations as values.
On This Page
Description Description
If a valid parameter is provided, returns the lowercase day name it identifies. If an invalid parameter is provided, returns false.
Parameters Parameters
- $zero_through_six
-
(int) (Optional) A number between 0 and 6 to identify a single day to return as a string.
Default value: null
Return Return
(string|Array|false)
Source Source
File: includes/class-invp.php
public static function weekdays( $zero_through_six = null ) {
$days = array(
'monday' => __( 'Mon', 'inventory-presser' ),
'tuesday' => __( 'Tue', 'inventory-presser' ),
'wednesday' => __( 'Wed', 'inventory-presser' ),
'thursday' => __( 'Thu', 'inventory-presser' ),
'friday' => __( 'Fri', 'inventory-presser' ),
'saturday' => __( 'Sat', 'inventory-presser' ),
'sunday' => __( 'Sun', 'inventory-presser' ),
);
/**
* If a valid parameter is provided, return the lowercase day name
* it identifies.
*/
if ( null !== $zero_through_six ) {
if ( 0 <= $zero_through_six && 6 >= $zero_through_six ) {
return array_keys( $days )[ $zero_through_six ];
} else {
// If an invalid parameter is provided, return false.
return false;
}
}
return $days;
}
Expand full source codeCollapse full source codeView on Github