PHP Classes

File: example.php

Recommend this page to a friend!
  Classes of Ming Choi   Text Parse   example.php   Download  
File: example.php
Role: Example script
Content type: text/plain
Description: example
Class: Text Parse
Get statistics and beautify text strings
Author: By
Last change: update
Date: 13 years ago
Size: 1,843 bytes
 

Contents

Class file image Download
<pre><?
//TextParse Class Example
require "TextParse.class.php";

//give it the text
$text = new TextParse(
"PHP:Hypertext Preprocessor is a widely used, general-purpose scripting language that was originally designed for web development to produce dynamic web pages... .. .. For this purpose,PHP code is embedded into the HTML source document and interpreted by a web server with a PHP processor module, which generates the web page document.




As a general-purpose programming language, PHP code(PHP CODE)is processed by an interpreter application in command-line mode performing desired operating system operations and producing program output on its standard output channel.It may also function as a graphical application...... PHP is available as a processor for most modern web servers and as standalone interpreter on most operating systems and computing platforms.123456"
);

echo
"Lenght:". $text->getLenght() ."\n"; //the Lenght

echo "Character:". $text->getCharacter() ."\n"; //Character count

echo "Letter:". $text->getLetter() ."\n"; //Letter count

echo "Number:". $text->getNumber() ."\n"; //Number count

echo "Space:". $text->getSpace() ."\n"; //Space count

echo "Symbol:". $text->getSymbol() ."\n"; //Symbol count(non letter / space / \n / \r)

echo "Word:". $text->getWord() ."\n"; //Word count
echo "The Words:";
print_r($text->getWord(1)); //the Words
echo "\n";

echo
"Sentence:". $text->getSentence() ."\n"; //Sentence count
echo "The Sentences:";
print_r($text->getSentence(1)); //the Sentences
echo "\n";

echo
"Paragraph:". $text->getParagraph() ."\n"; //Paragraph count
echo "The Paragraphs:";
print_r($text->getParagraph(1)); //the Paragraphs
echo "\n";

echo
"Beautified Text:\n". $text->beautify(80); //beautify the text, wordwrap=80

?>