• Categories
    • PHP
    • phpMyAdmin
    • PHPMailer
    • FFMpeg
    • PHPEXcel
    • PHPDoc
    • PHPUnit
    • CakePHP
    • CakePHP 2.0
    • Cake PHP 2.1
    • CakePHP Model
    • Facebook PHP SDK
    • composer-php
    • PHP 7
    • PHP GD
    All Categories
  • About

Show rotation of tweets using current day of month

phparraysdate


PHP Snippet 1:

$tweetLookup = [
    'Four',
    'One',
    'Two',
    'Three',
];
for ($i = 0; $i <= 25; $i++) {
    echo $i . ": " . $tweetLookup[date("d", strtotime( "+$i days")) % 4];
    echo "\n";
}

PHP Snippet 2:

0: One
1: Two
2: Three
3: Four
4: One
5: Two
6: Three
7: Four
8: One
9: Two
10: One
11: Two
12: Three
13: Four
14: One
15: Two
16: Three
17: Four
18: One
19: Two
20: Three
21: Four
22: One
23: Two
24: Three
25: Four

Related Snippets

Combine array with same value and add other [duplicate]

MOODLE: What does it mean to aggregate h5p assets?

How to get variable from JavaScript to PHP [duplicate]

PHP: Print caught exception like Xdebug

Trying to iterate over a mongodb cursor twice - failing

Passing PHP JSON to Javascript: echo json_encode vs echo json declaration

How can I pass the list to the component variable in Laravel?

Chunk and transpose a flat array into rows with a specific number of columns

Laravel 5: Is there a non-case sensitive way to sort a collection by an attribute?

array_map triple dimensional array [duplicate]

What is the difference between client-side and server-side programming?

Laravel implode array items to new lines

php echo xml documents with header

Wordpress wpdb->delete issue

Multiply each value in array using array_map function

About Contact Privacy policy Terms and conditions