₦airaland Forum

Welcome, Guest: RegisterLoginWith GoogleTrendingRecentNew

Stats: 3,325,094 members, 8,420,299 topics. Date: Thursday, 04 June 2026 at 03:55 PM

Toggle theme

Does Php Has A Similar Function? - Webmasters - Nairaland

Nairaland ForumScience/TechnologyWebmastersDoes Php Has A Similar Function? (588 Views)

1 Reply (Go Down)

Does Php Has A Similar Function? by deco2come(op): 6:59am On Feb 02, 2011
window.setTimeout()

I want to set an event to happen in the future. I want to set the time to run in server instead of clients side.
Re: Does Php Has A Similar Function? by viewspro: 9:26am On Feb 02, 2011
Hello,

I don't really know the details of you are trying to achieve, but if you time interval on the server then try using Cron Jobs.

Hope this helps!
Re: Does Php Has A Similar Function? by Nobody: 9:28am On Feb 02, 2011
sure it can be done. There are 2 ways.
Method 1: ehm, i think it is called sleep
por ejemplo
// sleep for 10 seconds
sleep(10);

method 2: use a cron job - look it up on google.
a cron job is done in such a way that the script runs at a time in the future.
that is how those birthday cards and reminders work. . .

- hasta la vista
Re: Does Php Has A Similar Function? by kodewrita(m): 4:35pm On Feb 05, 2011
Your server might not have a cron feature so let me teach you a trick.

it goes like this.

create an image like this
<img src="put a link to the script you want to run" width="1" height="1" style="display:none;"> and place it on the home page or on any regularly viewed page.

once the user opens the page, the image link will be requested by the browser, what will happen at the other end is that your script will be activated. all you now have to do is time() and check whether its the appropriate time for what you want to do.

if it is your script does what it needs to do and exits silently. you dont have to worry about the page, it will timeout the request once your script exits and a 1-pixel wide image is not going to affect your page at all.

preferably put it in the footer.

I am using that trick in a project I am working on. works everytime.
Re: Does Php Has A Similar Function? by Nobody: 6:10am On Feb 06, 2011
sure codewriter, this is similar to ehm poormanscron module in drupal cms
1 Reply

Learn How To Design A Dynamic Web Site Similar To Nairaland Just For FreePlease Who Knows Any Joomla Or Wordpress Theme Similar To Jumia Or Konga.comWriting A Time Based Expiration Script Or Function Using Php And Mysql234

Matrix Technology And Consult [mtc]Biwobihade256Which Hp Laptop Model Is The Best?