* @ingroup UtfNormal
*/
-if( PHP_SAPI != 'cli' ) {
+if ( PHP_SAPI != 'cli' ) {
die( "Run me from the command line please.\n" );
}
function randomString( $length, $nullOk, $ascii = false ) {
$out = '';
- for( $i = 0; $i < $length; $i++ )
+ for ( $i = 0; $i < $length; $i++ )
$out .= chr( mt_rand( $nullOk ? 0 : 1, $ascii ? 127 : 255 ) );
+
return $out;
}
$funky = $formatter->format( $diffs );
$matches = array();
preg_match_all( '/<(?:ins|del) class="diffchange">(.*?)<\/(?:ins|del)>/', $funky, $matches );
- foreach( $matches[1] as $bit ) {
+ foreach ( $matches[1] as $bit ) {
$hex = bin2hex( $bit );
echo "\t$hex\n";
}
$size = 16;
$n = 0;
-while( true ) {
+while ( true ) {
$n++;
echo "$n\n";
- $str = randomString( $size, true);
+ $str = randomString( $size, true );
$clean = UtfNormal::cleanUp( $str );
$norm = donorm( $str );
echo strlen( $clean ) . ", " . strlen( $norm );
- if( $clean == $norm ) {
+ if ( $clean == $norm ) {
echo " (match)\n";
} else {
echo " (FAIL)\n";
echo "\traw: " . bin2hex( $str ) . "\n" .
- "\tphp: " . bin2hex( $clean ) . "\n" .
- "\ticu: " . bin2hex( $norm ) . "\n";
+ "\tphp: " . bin2hex( $clean ) . "\n" .
+ "\ticu: " . bin2hex( $norm ) . "\n";
echo "\n\tdiffs:\n";
showDiffs( $clean, $norm );
die();
}
-
$str = '';
$clean = '';
$norm = '';