use php\net\ServerSocket;
use php\lang\Thread;
$thread = new Thread(function () {
$socket = new ServerSocket();
$socket->bind("127.0.0.1", 80);
while ($client = $socket->accept()) {
$content = $client->read(1); // читаем 1 байт из сокета
uiLater(function() use ($content) {
$this->textArea->text .= $content;
});
$client->close();
}
});
$thread->start();
$code = '1 + 2)';
$parser = new PHPParser_Parser(new PHPParser_Lexer);
try {
$stmts = $parser->parse($code);
} catch (PHPParser_Error $e) {
echo 'Parse Error: ', $e->getMessage();
}