Skip to content
View in the app

A better way to browse. Learn more.

MSFN

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

how to change image according to time (PHP)

Featured Replies

I am working on Radio website where i have to show image of program that's on air according to name of day and time. i made something that works but it works for hours not for minutes. i want it to be shown by minutes

like some program is from 04:30AM to 05:00AM. my code only works for hours like 04:00 AM to 05:00AM..

i created a function that gets program name according to name of day.

here's is how my code looks like



function get_program_name($name_of_day){ //
date_default_timezone_set('Asia/Kathmandu'); //Asia/Kathmandu.
$timehour=date('h');
switch ($name_of_day) { //switching case starts here

case 'Sunday':
if (05<=$timehour && &timehour <06) { // 05:00AM to 06:00AM
$current_program='current_program.jpg';
$upcoming_program='upcoming_program.jpg'

elseif (06<=$timehour && timehour <07) { // 06:00AM to 07:00AM
$current_program='current_program.jpg';
$upcoming_program='upcoming_program.jpg'
}
}
break;

case 'Monday':

break;

case 'Tuesday':

break;

case 'Wednesday':

break;

case 'Thrusday':

break;

case 'Friday':

break;

case 'Saturday':

break;

default:
echo "Something went wrong!!";
break;
}//case closes here
}//function closes here
get_program_name('Sunday');

thanks in advanced..

Edited by sanjeev18

  • 3 weeks later...

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.