PHP code example of amphp / parser
1. Go to this page and download the library: Download amphp/parser library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
amphp / parser example snippets
$parser = new Parser((function () {
while (true) {
$line = yield "\r\n";
if (trim($line) === "") {
continue;
}
print "New item: {$line}" . PHP_EOL;
}
})());
for ($i = 0; $i < 100; $i++) {
$parser->push("bar\r");
$parser->push("\nfoo");
}