Index: trunk/phase3/includes/normal/UtfNormalTest2.php |
— | — | @@ -13,8 +13,13 @@ |
14 | 14 | |
15 | 15 | // From http://unicode.org/Public/UNIDATA/NormalizationTest.txt |
16 | 16 | $file = "NormalizationTest.txt"; |
17 | | -$sep = ';'; |
18 | | -$comment = "#"; |
| 17 | + |
| 18 | +// Anything after this character is a comment |
| 19 | +define ( 'COMMENT', '#' ); |
| 20 | + |
| 21 | +// Semicolons are used to separate the columns |
| 22 | +define ( 'SEPARATOR', ';' ); |
| 23 | + |
19 | 24 | $f = fopen($file, "r"); |
20 | 25 | |
21 | 26 | /** |
— | — | @@ -208,12 +213,10 @@ |
209 | 214 | } |
210 | 215 | |
211 | 216 | function getRow( $f ) { |
212 | | - global $comment, $sep; |
213 | | - |
214 | 217 | $row = fgets( $f ); |
215 | 218 | if( $row === false ) return false; |
216 | 219 | $row = rtrim($row); |
217 | | - $pos = strpos( $row, $comment ); |
| 220 | + $pos = strpos( $row, COMMENT ); |
218 | 221 | $pos2 = strpos( $row, ")" ); |
219 | 222 | if( $pos === 0 ) return array($row); |
220 | 223 | $c = ""; |
— | — | @@ -225,8 +228,8 @@ |
226 | 229 | } |
227 | 230 | |
228 | 231 | $ret = array(); |
229 | | - foreach(explode( $sep, $row ) as $ent) { |
230 | | - if(trim($ent) !== "") { |
| 232 | + foreach( explode( SEPARATOR, $row ) as $ent ) { |
| 233 | + if( trim( $ent ) !== "" ) { |
231 | 234 | $ret[] = unistr($ent); |
232 | 235 | } |
233 | 236 | } |