global statement removal: hphp/test/zend [2/x]
[hiphop-php.git] / hphp / test / zend / good / ext / iconv / tests / iconv_substr_basic.php
blob2190219116d3c038d7c78231bb0d801b1e3f9571
1 <?php
2 /* Prototype : string iconv_substr(string str, int offset, [int length, string charset])
3 * Description: Returns part of a string
4 * Source code: ext/iconv/iconv.c
5 */
7 /*
8 * Test Basic Functionality of iconv_substr with ASCII characters and multibyte strings.
9 */
11 echo "*** Testing iconv_substr() : basic functionality ***\n";
13 $string_ascii = b'ABCDEF';
14 //Japanese string in UTF-8
15 $string_mb = base64_decode(b'5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCMDEyMzTvvJXvvJbvvJfvvJjvvJnjgII=');
17 echo "\n-- ASCII string 1 --\n";
18 var_dump(bin2hex(iconv_substr($string_ascii, 3)));
20 echo "\n-- ASCII string 2 --\n";
21 var_dump(bin2hex(iconv_substr($string_ascii, 3, 5, 'ISO-8859-1')));
23 echo "\n-- Multibyte string 1 --\n";
24 $result_1 = iconv_substr($string_mb, 2, 7);
25 var_dump(bin2hex($result_1));
27 echo "\n-- Multibyte string 2 --\n";
28 $result_2 = iconv_substr($string_mb, 2, 7, 'utf-8');
29 var_dump(bin2hex($result_2));
31 echo "Done";