File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -19,21 +19,25 @@ PHPThreads requires the following PHP extensions:
1919
2020## Quick and dirty example!
2121
22- `<?php
22+ ```
23+ <?php
2324require_once '../lib/phpthread.php'; /* Use correct path! */
2425
2526function thread_proc( $thread,
2627 $param)
2728{
2829 echo "\n\t[PHPTHREAD] - I've started and have a param: \"" . print_r($param, true) . "\"!\n";
30+
2931 for ($i = 0; $i < 15; $i++) {
3032 usleep(1000000);
3133 echo "\t[PHPTHREAD] - Tick!\n";
3234 }
35+
3336 $myobj = (object)array(
3437 'seconds_alive'=>$i,
3538 'lucky_number'=>rand(0, 10000)
3639 );
40+
3741 echo "\n\t[PHPTHREAD] - I'm returning this:\n";
3842 print_r($myobj);
3943 echo "\n";
@@ -52,4 +56,5 @@ for ($i = 0; $i < 5; $i++) {
5256echo "\n[MAIN] - Okay, I'm tired. Waiting on child to quit.\n";
5357phpthread_join($id, $retval);
5458echo "\n[MAIN] - Child is done. It returned:\n";
55- print_r($retval);`
59+ print_r($retval);
60+ ```
You can’t perform that action at this time.
0 commit comments