Location: PHPKode > scripts > Parse keywords from text > parse-keywords-from-text/example.php
<?
require 'text.class.php';

$text = new Text ('text.txt', 4); // source-file, minimal strlen (by default 4)
 
$start = microtime(true);
// Returns all words (array)
$get_all = $text->get_all ();
var_dump ($get_all);
echo '<br>'.(microtime(true)-$start).'<hr><br>';
$start = microtime(true);

// Returns elements from 0 to 100 (array)
$get_limit = $text->get_limit (0, 100);
var_dump ($get_limit);
echo '<br>'.(microtime(true)-$start).'<hr><br>';
$start = microtime(true);

// Returns elements frequency > 500 (array)
$get_count_limit = $text->get_count_limit (500);
var_dump ($get_count_limit);
echo '<br>'.(microtime(true)-$start);

// Example ยน4
?>
<meta name="keywords" content="<?=implode (', ',$text->get_limit (0, 20));?>" />
Return current item: Parse keywords from text