Question

US Presidential elections are held every four years. Assume a year has 365 days. Today is...

US Presidential elections are held every four years. Assume a year has 365 days. Today is the 51st day of 2018. Election day is November 3rd, 2020 -- that is the 307th day of 2020. Write me the PHP for a loop that will print out the number of days every day until the next Presidential election (980, 979, ...).

0 0
Add a comment Improve this question Transcribed image text
Answer #1

I understood that you want how many days left from today to the US election will be held on November 3rd, 2020. So every day when you run the PHP program it will show the number of days left. I do the program that way but if you want any other output please mention it.

PHP Code

<?php
$elec_date = strtotime("2020-11-03");
$cur = time();
$days_left = $elec_date - $cur;
$days = floor($days_left/(60*60*24));
echo "The days Remaining for election <b>$days</b>";
?>

60*60*24 I use this to convert it into seconds.

Output

Clocalhost/HomeworkLib/date.php The days Remaining for election 985

Add a comment
Know the answer?
Add Answer to:
US Presidential elections are held every four years. Assume a year has 365 days. Today is...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • . The Melbourne cup is run every year on the first Tuesday in November. The US presidential elect...

    please use congruence to work out b . The Melbourne cup is run every year on the first Tuesday in November. The US presidential elections İU are held every four years on the day after the first Monday in November. George W. Bush was elected on Tuesday 7 November 2000 and "Brew" won the Melbourne cup the same day. (a) Who won cup? ection this century which did not hanmen on the same day as a Melbourme did not hannen...

  • Assuming that a year has 365 days, write a class named DayOfYear that takes an integer...

    Assuming that a year has 365 days, write a class named DayOfYear that takes an integer representing a day of the year and translates it to a string consisting of the month followed by day of the month. For example, Day 2 would be January 2. Day 32 would be February 1. Day 365 would be December 31. The constructor for the class should take as parameter an integer representing the day of the year, and the class should have...

  • Today is July 1, 2024. Four years ago, when you started your first job after gradusting...

    Today is July 1, 2024. Four years ago, when you started your first job after gradusting from ohio state in 2020, you began saving s portion of your salary in your company's 401 savings plan. Your salary is $60,000 annually, of which you decide to put 10% in the use annual deposits for simplicity.) Assume the savings plan earns 9% interest annually savings plan at the end of each year. (in reality, a portion is saved from each paycheck, but...

  • The Economist article “Indonesias economic growth is being held back by populism,” (see below) highlights a...

    The Economist article “Indonesias economic growth is being held back by populism,” (see below) highlights a number of features of Indonesias economic growth potential (as of January, 2019). After reading the article, evaluate the quality of Indonesia’s policy environment. Specifically, consider which aspects of Indonesia’s policy and demographic setting are conducive to economic growth and which are inhibiting economic growth? Begin with a brief summary of the requirements for economic growth that are explained in Modules 20 and 22. When...

  • My question is about the case study “ Comparing Apples and Oranges: which group yuelds the...

    My question is about the case study “ Comparing Apples and Oranges: which group yuelds the best profit?” 1) Using the Excel apreadsheet attached to complete the rooms sold and revenue projections based on the above case study. Case Study: "Comparing Apples and Oranges: Which Group Yields the Best Profit?" ​The Diamond Peak Hotel, one of 45 hotels in the Host Marriott management company, was bustling with business this Thursday afternoon as the hour of the daily revenue meeting drew...

  • Code is in C# Your instructor would like to thank to Marty Stepp and Hélène Martin...

    Code is in C# Your instructor would like to thank to Marty Stepp and Hélène Martin at the University of Washington, Seattle, who originally wrote this assignment (for their CSE 142, in Java) This program focuses on classes and objects. Turn in two files named Birthday.cs and Date.cs. You will also need the support file Date.dll; it is contained in the starter project for this assignment. The assignment has two parts: a client program that uses Date objects, and a...

  • This year Evan graduated from college and took a job as a deliveryman in the city....

    This year Evan graduated from college and took a job as a deliveryman in the city. Evan was paid a salary of $68,500 and he received $700 in hourly pay for part-time work over the weekends. Evan summarized his expenses below: Cost of moving his possessions to the city (125 miles away) Interest paid on accumulated student loans Cost of purchasing a delivery uniform Contribution to State University deliveryman program $1,200 2,840 1,440 1,320 Calculate Evan's AGI and taxable income...

  • St. Francis Assisted Living Facility St. Francis Medical Center, a 450 bed rehabilitation non-profit hospital began...

    St. Francis Assisted Living Facility St. Francis Medical Center, a 450 bed rehabilitation non-profit hospital began to see a significant decline in admissions. St. Francis' mission focuses on inpatient and outpatient rehabilitation of the severely injured and catastrophically ill. While the patient census varied from month to month, it appeared to the St. Francis Board of Trustees that the inpatient population was slowly but steadily declining. The hospital's market researchers reported that fewer people were being severely injured due to...

  • In your judgement, and given only the facts described in this case, should the management of...

    In your judgement, and given only the facts described in this case, should the management of Massey energy Company be held morally responsible for the deaths of the 29 miners? Explain in detail. Suppose that nothing more is learned about the explosion other than what is described in this case. Do you think Don Blankership should be held morally responsible for the deaths of the 29 miners? Explain in detail. Given only the facts described in this case, should the...

  • Hi there! I need to compare two essay into 1 essay, and make it interesting and...

    Hi there! I need to compare two essay into 1 essay, and make it interesting and choose couple topics which im going to talk about in my essay FIRST ESSAY “Teaching New Worlds/New Words” bell hooks Like desire, language disrupts, refuses to be contained within boundaries. It speaks itself against our will, in words and thoughts that intrude, even violate the most private spaces of mind and body. It was in my first year of college that I read Adrienne...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT