From c037ae23e58a0aae754b84c2945b5a67c9ecc27f Mon Sep 17 00:00:00 2001 From: Platonides Date: Tue, 30 Nov 2010 23:46:14 +0000 Subject: [PATCH] Use constants. Add spacing. --- includes/normal/UtfNormalTest2.php | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/includes/normal/UtfNormalTest2.php b/includes/normal/UtfNormalTest2.php index 960f346e16..fafd5475f6 100644 --- a/includes/normal/UtfNormalTest2.php +++ b/includes/normal/UtfNormalTest2.php @@ -13,8 +13,13 @@ if( php_sapi_name() != 'cli' ) { // From http://unicode.org/Public/UNIDATA/NormalizationTest.txt $file = "NormalizationTest.txt"; -$sep = ';'; -$comment = "#"; + +// Anything after this character is a comment +define ( 'COMMENT', '#' ); + +// Semicolons are used to separate the columns +define ( 'SEPARATOR', ';' ); + $f = fopen($file, "r"); /** @@ -208,12 +213,10 @@ function unistr($c) { } function getRow( $f ) { - global $comment, $sep; - $row = fgets( $f ); if( $row === false ) return false; $row = rtrim($row); - $pos = strpos( $row, $comment ); + $pos = strpos( $row, COMMENT ); $pos2 = strpos( $row, ")" ); if( $pos === 0 ) return array($row); $c = ""; @@ -225,8 +228,8 @@ function getRow( $f ) { } $ret = array(); - foreach(explode( $sep, $row ) as $ent) { - if(trim($ent) !== "") { + foreach( explode( SEPARATOR, $row ) as $ent ) { + if( trim( $ent ) !== "" ) { $ret[] = unistr($ent); } } -- 2.20.1