PHP code example of funivan / php-tokenizer
1. Go to this page and download the library: Download funivan/php-tokenizer 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/ */
funivan / php-tokenizer example snippets
use Funivan\PhpTokenizer\Collection;
use Funivan\PhpTokenizer\Pattern\PatternMatcher;
use Funivan\PhpTokenizer\QuerySequence\QuerySequence;
$source = " while(){}"; // while (){}
$collection = Collection::createFromString($source);
(new PatternMatcher($collection))->apply(function (QuerySequence $checker) {
$while = $checker->strict('while');
$space = $checker->possible(T_WHITESPACE);
if ($checker->isValid()) {
$space->remove();
$while->appendToValue(" ");
}
});
echo (string) $collection;
bash
composer