We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 319d60b commit 8c5e9a3Copy full SHA for 8c5e9a3
demos/demo.php
@@ -10,10 +10,16 @@
10
echo date('c') . ' :: Sending process. You should not wait any longer to see next message: ' . PHP_EOL;
11
12
try {
13
- $process->send(function () {
+ $age = 30;
14
+ $name = 'John Doe';
15
+ $fruits = ['orange', 'apple', 'grape'];
16
+ $process->send(function () use ($age, $name, $fruits) {
17
sleep(5);
- echo 123;
- file_put_contents('demo.txt', 'Hello, World! At: ' . date('c'));
18
+ echo 123; // you should not see this anywhere
19
+ file_put_contents(
20
+ 'demo.txt',
21
+ "Age: $age\nName: $name\nFruits: " . implode(', ', $fruits) . ' - ' . date('c')
22
+ );
23
});
24
} catch (Exception $e) {
25
echo $e->getMessage();
0 commit comments