PHP for callback circular. Ask the master!

There follows an asynchronous method:
function hello($message,$test,$txt){    ​
    ​for($k=0;$k<$con;$k++)
    ​	 {
       ​ ​$fp=fsockopen('localhost',8080,&$errno,&$errstr,5);
    ​    ​fwrite($fp,"GET /Hello/js_push?message=".$message."&test=".$test."&txt=".$txt." \r\n");
    ​}
}

Js_push functions are as follows:
function js_push(){
    ​	 ignore_user_abort();
    ​	 set_time_limit(0);
    ​...
    ​fwrite($fps, date('Y-m-d H:i:s').$value." \r\n");
    ​...
}

Question: I want in the js_push with a callback function, so that each of the fwrite ($fps, date ('Y-m-d H:i:s').$value. "\r\n"); after the execution, to execute the above for in the loop second, third, , ,
How to achieve it?

Started by Algernon at February 02, 2016 - 5:00 AM

Broadly, not understand...

Posted by Jacqueline at February 12, 2016 - 5:40 AM

That is, hello (for) this function asynchronous cycle, each call is js_push () function. I want every js_push () function is executed, the hello (for) this function re execution down.

Posted by Algernon at February 23, 2016 - 6:18 AM

Two functions belong to the two PHP files?

Posted by Jacqueline at March 04, 2016 - 6:39 AM

No, in an PHP file.

Posted by Algernon at March 12, 2016 - 7:17 AM

You are in the fwrite ($fp, "GET /Hello/js_push? M. After...
while(fgets($fp));
You can

Posted by Eugene at October 26, 2016 - 11:39 PM

A halo, it directly to the js_push () on the hello (for) on the line
function hello($message,$test,$txt){    ​
    ​for($k=0;$k<$con;$k++)
    ​     {
       ​ ​$fp=fsockopen('localhost',8080,&$errno,&$errstr,5);
        js_push();
    ​    ​fwrite($fp,"GET /Hello/js_push?message=".$message."&test=".$test."&txt=".$txt." \r\n");
    ​}
}

This does not work.?

Posted by Jacqueline at November 02, 2016 - 11:44 PM

Can not ah, this not is not asynchronous.?

Posted by Algernon at November 15, 2016 - 12:30 AM

What do you mean?

Posted by Algernon at November 30, 2016 - 1:17 AM

What do you mean? You're not going to wait to return it?
After the execution, to execute the above for cycle in second, third,,, is not waiting for you?

Posted by Eugene at December 12, 2016 - 2:16 AM

Oh, never used before, so I ask what

Posted by Algernon at December 26, 2016 - 3:10 AM

If, I think every call to hello () function, as a process, how to do?

Posted by Algernon at January 03, 2017 - 4:48 AM

Even if you want to simulate multi thread, process, can only rely on the system and the external module

Posted by Jacqueline at January 06, 2017 - 3:45 AM

The external module? For example? What external module is relatively easy to use?
Also, if I want after 10 cycles of for, perform while again (fgets ($fp)); how to achieve it?

Posted by Algernon at January 08, 2017 - 4:03 AM