php-ipc/examples/channels.php

16 lines
326 B
PHP

<?php
require_once __DIR__."/../vendor/autoload.php";
use NoccyLabs\Ipc\Interop\Channel\StreamChannel;
// Create a pair of channels.
[ $ch1, $ch2 ] = StreamChannel::createPair();
// Send messages with send()
$ch1->send([
'msg' => "Hello World"
]);
// Receive at the other end using receive()
print_r($ch2->receive());