<html>
<head>
	<title>patSysinfo - examples</title>
</head>
<body>
	<b>patSysinfo</b><br /><br />
	unit calculation<br /><br />
<pre>
------------8&lt;------------8&lt;------snip-snap------8&lt;------------8&lt;------------
<?php
error_reporting( E_ALL );
require_once '../../patError/patErrorManager.php';

patErrorManager::setErrorHandling( E_ERROR, 'verbose' );
patErrorManager::setErrorHandling( E_WARNING, 'verbose' );

require_once '../patSysinfo.php';

	echo "Play with numbers \n\n";

	// instantiate patSysinfo
	$info	=	&patSysinfo::create();
	
	// translate any number 
	$number	=	4365;
	
	// ...to a nice string
	echo "Translate number to Bytes, kBytes, MBytes and GBytes \n";
	$nice	=	$info->unitCalc( $number );
	echo $number . ' Bytes ==&gt; ' . $nice . "\n";
	echo "This is the default behaviour\n";
	
	echo "\n";

	// translate to custum number formats by passing the format definition to unitCalc
	echo "If you are a scientist, you probably want to translate numbers like this:\n";
	$nice	=	$info->unitCalc( $number, 1000, array( '', 'k', 'M', 'G' ) );
	echo $number . ' ==&gt; ' . $nice . "\n";
	
	echo "\n";
	
	// ...you also can configure patSysinfo's unitCalc for further use	
	$info->setUnitCalcConfig( true, 12, array( '', 'dozen' ) );	
	echo "Imagine we live in a word of dozens \n";
	$nice	=	$info->unitCalc( $number );
	echo $number . ' ==&gt; ' . $nice . "\n";
?>
------------8&lt;------------8&lt;------snip-snap------8&lt;------------8&lt;------------
</pre>
<br />
Download and documentation at <a href="http://www.php-tools.net">www.php-tools.net</a><br />
CVS-Repository at <a href="http://cvs.php-tools.net">cvs.php-tools.net</a><br />
</body>
</html>
