ultrus Posted January 18, 2007 Share Posted January 18, 2007 Hello,Is it possible to have php watch a variable for a certain amount of time and call a function once the variable changes?I'm using php to communicate with another server through COM that can only process one thing at a time. Once it is done processing, a variable changes, meaning that I can access the server again to process something else. If I try to process something while the other server is not idle, I get error messages. Any thoughts on this? :-\ Link to comment https://forums.phpfreaks.com/topic/34693-wait-for-variable-change-before-calling-function/ Share on other sites More sharing options...
taith Posted January 18, 2007 Share Posted January 18, 2007 not that i know of... however if you set a blank page to refresh every 5-10 seconds, have your phpcode there, that'd do the job... no? Link to comment https://forums.phpfreaks.com/topic/34693-wait-for-variable-change-before-calling-function/#findComment-163576 Share on other sites More sharing options...
ultrus Posted January 18, 2007 Author Share Posted January 18, 2007 I bet that would work. One thing that seems to work now for me is using the sleep() function to pause between every communication with the external server. Another idea based on what you said, would be to create a "waiting list" of tasks, and have a cron check the status of the server, and manage tasks in order every second.Thanks for the inspiration! Link to comment https://forums.phpfreaks.com/topic/34693-wait-for-variable-change-before-calling-function/#findComment-163700 Share on other sites More sharing options...
taith Posted January 18, 2007 Share Posted January 18, 2007 no problem... sorry... i dont know crons... cant help ya out with that... lolonly problem with sleep() is that while() functions can time out... it may just cause ya some problems there... Link to comment https://forums.phpfreaks.com/topic/34693-wait-for-variable-change-before-calling-function/#findComment-163706 Share on other sites More sharing options...
ultrus Posted January 18, 2007 Author Share Posted January 18, 2007 ah! I will keep that in mind. As far as crons go....ehhhh. I'll do the research and/or make a seperate post another time. :) Link to comment https://forums.phpfreaks.com/topic/34693-wait-for-variable-change-before-calling-function/#findComment-163708 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.