global statement removal: hphp/test [7/x]
[hiphop-php.git] / hphp / test / quick / iconv_stream_filter.php
blobf0f7d88a70cb17b3bc5de9ab036f8cb35a1b6ce6
1 <?hh
3 foreach(array('UTF-8', 'UCS-2LE') as $targetCharset) {
4 $s = fopen('php://memory', 'rw');
5 fwrite($s, "\xe9"); // euro currency symbol in ISO-8859-1
6 fseek($s, 0);
7 stream_filter_append($s, "convert.iconv.ISO-8859-1/$targetCharset");
8 $utf8Symbol = stream_get_contents($s);
9 echo 'Euro symbol in ' . $targetCharset;
10 echo ' has content "' . bin2hex($utf8Symbol) . '"';
11 echo ' and size ' . strlen($utf8Symbol) . 'b', "\n";