= 1... $msgq->send(1, [ "what"=>"First" ]); $msgq->send(2, [ "what"=>"Second" ]); $msgq->send(3, [ "what"=>"Third" ]); // Read messages by requesting a type... $msg = $msgq->receive(2, $type); printf("msg: %s, type: %d\n", json_encode($msg), $type); // ...or read the first message with type 0... $msg = $msgq->receive(0, $type); printf("msg: %s, type: %d\n", json_encode($msg), $type); $msg = $msgq->receive(0, $type); printf("msg: %s, type: %d\n", json_encode($msg), $type); $msgq->destroy();