PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
what i want is to put the doSomething() into a different PHP file, so when i call it using something like file_get_contents() it gets executed. But if i use file_get_contents(), it will wait for the whole file to get loaded before doing it the next time, which defeats the purpose. Is there any code that might help?
concurrent loading isn't very possible with PHP. It's not a multithreaded language in that regard, or any regard that I know of. The best you may be able to do is shunt it to a separate script via a shell execution. However I'm not sure that'd work either. Using shared memory should technically make it possible, but somewhat difficult to synchronize.
his idea is to trick the script into thinking that 'b.php' is empty, so that 'a.php' will continue and execute 'b.php' again straight away, while 'b.php' executes the 'doSomething()' function concurrently. is this possible?
If your using Unix/Linux, then use PHP(s) pcntl_fork() function and then create some children to do your dirty work, LoL, who can run in parallel (run at the same time) On windows you can only do this Perl, thanks to Microsoft paying the O'Reilly team to add fork() elimination to the Perl compiler...