note 125792 added to parallel.run

From: Date: Sun, 07 Feb 2021 14:49:44 +0000
Subject: note 125792 added to parallel.run
Groups: php.notes 
Request: Send a blank email to php-notes+get-219183@lists.php.net to get a copy of this message
Although function declaration is not allowed inside thread exec code, include is allowed. So if we want to declare a function, we could write another file that contain the function and include it. # main.php <?php $runtime = new parallel\Runtime (); $future = $runtime->run ( function () { $future = $runtime->run ( function () { include "included.php"; return add (1, 3); }, [ ] ); echo $future->value (); # output: 4 # included.php <?php function add($a, $b){ return $a + $b; } ---- Server IP: 45.112.84.4 Probable Submitter: 45.91.159.166 (proxied: 2001:ee0:4f91:60:61af:b61f:8bee:2c34) ---- Manual Page -- http://php.net/manual/en/parallel.run.php Edit -- https://master.php.net/note/edit/125792 Del: integrated -- https://master.php.net/note/delete/125792/integrated Del: useless -- https://master.php.net/note/delete/125792/useless Del: bad code -- https://master.php.net/note/delete/125792/bad+code Del: spam -- https://master.php.net/note/delete/125792/spam Del: non-english -- https://master.php.net/note/delete/125792/non-english Del: in docs -- https://master.php.net/note/delete/125792/in+docs Del: other reasons-- https://master.php.net/note/delete/125792 Reject -- https://master.php.net/note/reject/125792 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#219183) next »