1. Go to this page and download the library: Download xp-framework/tokenize 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/ */
xp-framework / tokenize example snippets
use text\{StringTokenizer, StreamTokenizer};
use io\File;
// Supports strings and streams
$tokens= new StringTokenizer('He asked: Can you parse this?', ' .?!,;:', true);
$tokens= new StreamTokenizer((new File('parse-me.txt'))->in(), ' .?!,;:', true);
// Can iterate using foreach...
foreach ($tokens as $token) {
Console::writeLine($token);
}
// ...or with an iterator API
while ($tokens->hasMoreTokens()) {
Console::writeLine($tokens->nextToken());
}
// Returns: ["He", " ", "asked", ":", " ", "Can", " ", "you", " ", "parse", " ", "this", "?"]
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.