Location: PHPKode > scripts > Misc String > misc-string/example/whitespace.php
<?php
/**
 * This is a test file for strWhitespace class from MiscString package.
 * Run this file in your browser and submit some text.
 * 
 * @package Test MiscString
 * @author Vladislav Bailovic <hide@address.com>
 */


include ('../miscstring.php');

$reply = @$_POST['text'];

$s = new strWhitespace();


?>
<!--------------------------- PREVIEW ------------------------->
<div style="border: 3px solid #EEE; margin: 2em">
	<dl>
	<dt>original</dt><dd><pre><?=$reply?></pre></dd>
	<dt>strNormal::stripNewlines()</dt><dd><pre><?=$s->stripNewlines($reply)?></pre></dd>
	<dt>strNormal::stripEmptyLines()</dt><dd><pre><?=$s->stripEmptyLines($reply)?></pre></dd>
	<dt>strNormal::spacesToTabs()</dt><dd><pre><?=$s->spacesToTabs($reply)?></pre></dd>
	<dt>strNormal::tabsToSpaces(strNormal::spacesToTabs())</dt><dd><pre><?=$s->tabsToSpaces($s->spacesToTabs($reply))?></pre></dd>
	<dt>strNormal::normalizeSpace()</dt><dd><pre><?=$s->normalizeSpace($reply)?></pre></dd>
	<dt>strNormal::normalizeWhitepace()</dt><dd><pre><?=$s->normalizeWhitespace($reply)?></pre></dd>
	<dt>strNormal::htmlHardSpaces()</dt><dd><pre><?=$s->htmlHardSpaces($reply)?></pre></dd>
	</dl>
</div>
<!--------------------------- FORM ------------------------->
<h3>Enter a few paragraphs of text to test:</h3>
<form action='<?=$_SERVER['PHP_SELF']?>' accept-charset='utf-8' method='post'>
	<textarea rows='8' 
		style="width:100%;border: 1px solid black" name='text'><?=@$_POST['text']?></textarea>
	<br />
	<input type='submit' />
</form>
Return current item: Misc String