You are here: window.setTimeout equivalent in PHP? « PHP Programming Language « IT news, forums, messages
window.setTimeout equivalent in PHP?

Posted by Csaba Gabor on 09/02/07 22:51

Is there a straightforward way of implementing a PHP equivalent to
window.setTimeout?

In a javascript web app, it's often the case that things are done on
an event driven basis. For example, html elements might have things
like onclick="buttonClicked()" to indicate that the function
buttonClicked should be run when that element is clicked.

The analogue can be done in PHP (on Windows) using com_event_sink. In
other words, you can respond to events that a COM object (such as
Excel, Internet Explorer, Words, etc) experiences via a PHP function.
Of course, at the end of your PHP script you would have a loop to the
effect of
while ($GLOBALS['keepLooping']) { com_message_pump(200); }
so that the PHP script stays in memory and doesn't terminate. That is
to say, in this way those event callback functions will be available.
So far, so good.

However, getting a PHP function to run on a timed basis (without any
delay loops) does not seem so easy, which leads to my question: Is
there a straightforward way of implementing a PHP equivalent to
window.setTimeout?

In other words, I'd like to be able to kick off a PHP function after a
certain amount of time has elapsed. One possible way to think of this
is an event driven Sleep. One way to do this is to ensure that I have
a copy of IE up, and then I can use IE's window's own .setTimeout to
tie it into PHP, but this is a bit messy not to mention that I don't
like the IE requirement.

Thanks for any ideas,
Csaba Gabor from Vienna

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация