Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7012955
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T22:19:24+00:00 2026-05-27T22:19:24+00:00

I am a beginner in PHP and would like to load a daily meditation

  • 0

I am a beginner in PHP and would like to load a daily meditation every day that is specific to that day.

So on January 1st, I would call the quote from 1_1.php and on the 2nd 1_2.php, and so on until February 1st which would call 2_1.php and on the 2nd 2_2.php on the third 2_3.php.

Is this possible and how hard would it be?

It would also be acceptable to have 365 files where it just called the next one in order every twenty-four hours, or one file with 365 lines and called a different line every day, but I do not know how to do this as I only know how to build in html and design so any help or advice would be great.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T22:19:25+00:00Added an answer on May 27, 2026 at 10:19 pm

    I would most definitely not use 365 different files. It might be sensible to use a database, but since these seem to be one-liners and you are new to PHP, the simples method is to them in a big array. The downside of this is that the whole array will be read and parsed on each page load. But I wouldn’t worry about the performance of that until it becomes a problem.

    $meditations = array(
      '1-Jan' => "Some meditation for today",
      '2-Jan' => "Some meditation for tomorrow",
      ...
      ...
      '28-Dec' => "Something for today",
      '29-Dec' => "Something for tomorrow",
      '30-Dec' => "Something for tomorrow2",
      '31-Dec' => "Something for new year's eve"
    );
    

    Then access them as:

    echo $meditations[date('j-M')];
    // Today will output
    //something for today
    

    If you prefer, insted of using the format dd-Mon for array keys, you can use numeric months as in:

    array('28-12' => "something for today");
    // Access as:
    echo $meditations[date('j-m')];
    

    The complete bit to include inside your PHP page (note it will need to be a .php page, rather than .html) is:

    <?php
    $meditations = array(
       '1-1' => "Some meditation for today",
       '2-1' => "Some meditation for tomorrow",
       // etc....
    );
    echo $meditations[date('j-m')];
    ?>
    

    You can alternatively store the huge array in its own file called meditations.php, and include it:

    File meditations.php

    <?php
    $meditations = array(
       '1-1' => "Some meditation for today",
       '2-1' => "Some meditation for tomorrow",
       // etc....
    );
    ?>
    

    Main file:

    <?php 
    include("meditations.php");
    echo $meditations[date('j-m')];
    ?>
    

    To include this in a plain HTML page (not .php), you’ll need an <iframe>. Assuming your PHP is working correctly in a file called meditations.php, call the <iframe> like this:

    <iframe src='meditations.php' />
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am a beginner in PHP programming and would like help with a little
I am a beginner with PHP and I would really like to understand it
As I am a beginner in the PHP programming field, I would like to
This is a topic that, as a beginner to PHP and programming, sort of
I'm a total beginner with TYPO3 and would like to show a RSS feed
I would like to add a value to each row that I get from
I'm a beginner with PHP security issues. Someone reported a security issue with my
i'm a beginner to php. i need to use php function which process some
I am a PHP beginner. I have developed a social networking website similar to
I'm a beginner in php, and I am trying to create a login and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.