xref: /PHP-7.2/ext/iconv/tests/iconv002.phpt (revision 17ccbeec)
1--TEST--
2iconv() test 2 (UCS4BE to ASCII)
3--SKIPIF--
4<?php
5include('skipif.inc');
6if (@iconv("ascii","UCS-4LE", "abcd") == '') {
7	die("skip conversion to UCS-4LE not supported");
8}
9?>
10--INI--
11error_reporting=2039
12--FILE--
13<?php
14/* include('test.inc'); */
15/*
16Expected output:
17&#97;&#98;&#99;&#100;
18abcd
19*/
20
21   $s = unpack("V*", iconv("ascii","UCS-4LE", "abcd"));
22   foreach($s as $c) { print "&#$c;"; } print "\n";
23
24   $s = pack("NNNN", 97, 98, 99, 100);
25   $q = iconv("UCS-4BE", "ascii", $s);
26   print $q; print "\n";
27?>
28--EXPECT--
29&#97;&#98;&#99;&#100;
30abcd
31