
January 16th, 2007, 05:45 AM
| | | Is there any function in PHP like setTimeout with same functionallity in javascript
hi frnds,
Is there any function in PHP like setTimeout with same
functionallity in javascript ..
Thing is, In php we have a function call settimeout for socket , But i
need the same functionallity of settimeout( ) fucntion of javascript in
PHP, Is that anything available in PHP. Is there plzzzzz reply me quick
Thank
Dinesh.. | 
January 16th, 2007, 06:55 AM
| | | Re: Is there any function in PHP like setTimeout with same functionallity in javascript
<balakrishnan.dinesh@gmail.comwrote: Quote:
Is there any function in PHP like setTimeout with same
functionallity in javascript ..
Thing is, In php we have a function call settimeout for socket , But i
need the same functionallity of settimeout( ) fucntion of javascript in
PHP, Is that anything available in PHP. Is there plzzzzz reply me quick
| Perhaps it would help people to help if you described the actual problem
that needs the solution.
Because if you compare php and javascript like that, there is usually a big
difference:
- javascript can manipulate page through dom object model and do things on
it again and again until user goes to another page.
- php _usually_ outputs a page, does some things in serverside and that's
it - goodbye, mypage! | 
January 16th, 2007, 07:15 AM
| | | Re: Is there any function in PHP like setTimeout with same functionallity in javascript
Hi,
My exact problem is, i want to call a function for every 100
seconds in PHP code | 
January 16th, 2007, 07:25 AM
| | | Re: Is there any function in PHP like setTimeout with same functionallity in javascript
<balakrishnan.dinesh@gmail.comwrote in message
news:1168931303.071685.241050@38g2000cwa.googlegro ups.com... Quote:
>
Hi,
>
My exact problem is, i want to call a function for every 100
seconds in PHP code
|
either make a cronjob to call it every nth second or make an infinitely
running daemon:
<?php
while(1){
// Do the magik
// Wait 100 seconds
sleep(100);
}
?>
a cronjob might be easier for the server to handle
--
"Ohjelmoija on organismi joka muuttaa kofeiinia koodiksi" - lpk http://outolempi.net/ahdistus/ - Satunnaisesti päivittyvä nettisarjis spam@outolempi.net | rot13(xvzzb@bhgbyrzcv.arg) | 
January 16th, 2007, 07:25 AM
| | | Re: Is there any function in PHP like setTimeout with same functionallity in javascript
On Jan 16, 6:42 am, balakrishnan.din...@gmail.com wrote: Quote:
Is there any function in PHP like setTimeout with same
functionallity in javascript ..
Thing is, In php we have a function call settimeout for socket , But i
need the same functionallity of settimeout( ) fucntion of javascript in
PHP, Is that anything available in PHP. Is there plzzzzz reply me quick
| You may want to read further documentation about pcntl
(especially pcntl_signal and pcntl_alarm).
--
Pierre | 
January 16th, 2007, 08:55 AM
| | | Re: Is there any function in PHP like setTimeout with same functionallity in javascript
either make a cronjob to call it every nth second or make an infinitely Quote:
running daemon:
<?php
>
while(1){
>
// Do the magik
>
// Wait 100 seconds
sleep(100);
}
>
?>
>
a cronjob might be easier for the server to handle
| I would like to know more about this, because this daemon solution is really
easy to do but is there some dangers with it:
- max_execution_time in php.ini
- is it causing stress to server. | 
January 16th, 2007, 09:15 AM
| | | Re: Is there any function in PHP like setTimeout with same functionallity in javascript
hi Kimmo,
Thanks for ur solution, But the problem with this solution is,
After 100 seconds only , the page is getting displayed ,until nothing
is displayed ..
what I need is, while the counter is running in "sleep(100)" ,
other process should be performed concurrently
Is there any way for that
Thank
Dinesh...
Kimmo Laine wrote: Quote:
<balakrishnan.dinesh@gmail.comwrote in message
news:1168931303.071685.241050@38g2000cwa.googlegro ups.com... Quote:
Hi,
My exact problem is, i want to call a function for every 100
seconds in PHP code
| >
>
either make a cronjob to call it every nth second or make an infinitely
running daemon:
<?php
>
while(1){
>
// Do the magik
>
// Wait 100 seconds
sleep(100);
}
>
?>
>
a cronjob might be easier for the server to handle
>
--
"Ohjelmoija on organismi joka muuttaa kofeiinia koodiksi" - lpk http://outolempi.net/ahdistus/ - Satunnaisesti päivittyvä nettisarjis spam@outolempi.net | rot13(xvzzb@bhgbyrzcv.arg)
| | 
January 16th, 2007, 09:45 AM
| | | Re: Is there any function in PHP like setTimeout with same functionallity in javascript
"P Pulkkinen" <perttu.POISTATAMA.pulkkinen@POISTATAMA.elisanet.f iwrote in
message news:be0rh.5262$KW2.3297@reader1.news.saunalahti.f i... Quote: Quote:
>either make a cronjob to call it every nth second or make an infinitely
>running daemon:
><?php
>>
>while(1){
>>
> // Do the magik
>>
> // Wait 100 seconds
> sleep(100);
>}
>>
>?>
>>
>a cronjob might be easier for the server to handle
| >
I would like to know more about this, because this daemon solution is
really easy to do but is there some dangers with it:
- max_execution_time in php.ini
| set_time_limit(0); should solve that, not sure thou. Quote: |
- is it causing stress to server.
| I don't know, haven't run any performance tests. Yet for some reason I'd
rather use cron for scheduling rather than this sort of solution.
--
"Ohjelmoija on organismi joka muuttaa kofeiinia koodiksi" - lpk http://outolempi.net/ahdistus/ - Satunnaisesti päivittyvä nettisarjis spam@outolempi.net | rot13(xvzzb@bhgbyrzcv.arg) | 
January 16th, 2007, 10:05 AM
| | | Re: Is there any function in PHP like setTimeout with same functionallity in javascript
<balakrishnan.dinesh@gmail.comkirjoitti
viestissä:1168938556.076852.50880@v45g2000cwv.goog legroups.com...
"But the problem with this solution is,
After 100 seconds only , the page is getting displayed ,until nothing
is displayed ..
what I need is, while the counter is running in "sleep(100)" ,
other process should be performed concurrently
Is there any way for that"
I want to ask:
Is this desired effect related to certain page of current user rather than
to your entire web service?
Why, because nowadays ajax-kind of things are applied to get up-to-second
content etc. to client side. More simply put, for example very small or
invisible iframe can be updated every n-second, with the helps of meta
refresh tag. That update call can do something on the server and then
something as well in the client, since other frames and main frame can dig
iframe's content. Even I have not yet applied this, but I see the point
anyway. It would very much simulate the work of timeout.
I have an impression that cron thing refers more to need to update or backup
the whole server content. It is running there on the server by itself,
calling on timely basis some 'pages' invisibly. (Please anyone, feel free to
correct me...) | 
January 16th, 2007, 03:35 PM
| | | Re: Is there any function in PHP like setTimeout with same functionallity in javascript balakrishnan.dinesh@gmail.com wrote: Quote:
hi Kimmo,
>
Thanks for ur solution, But the problem with this solution is,
After 100 seconds only , the page is getting displayed ,until nothing
is displayed ..
what I need is, while the counter is running in "sleep(100)" ,
other process should be performed concurrently
Is there any way for that
>
| Yes, but its not simple in PHP invoked from a webserver.
You've not really explained what you are trying to acheive.
Do you need a single thread of execution for the controlling process?
Must it be bound to a browser access? What are the failure modes? What
are the "other processes" to be performed concurrently? Should they
signal back to the browser? Should they run in a seperate process
group? Why does your script have to sleep while the other processes are
running? What have you tried?
C. |
Posting Rules
| You may not post new threads You may not post replies You may not post attachments You may not edit your posts HTML code is Off | | | | | | What is Bytes?
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over network members.
|