xref: /PHP-8.2/ext/iconv/tests/iconv002.phpt (revision e9f783fc)
1--TEST--
2iconv() test 2 (UCS4BE to ASCII)
3--EXTENSIONS--
4iconv
5--SKIPIF--
6<?php
7if (@iconv("ascii","UCS-4LE", "abcd") == '') {
8    die("skip conversion to UCS-4LE not supported");
9}
10?>
11--INI--
12error_reporting=2039
13--FILE--
14<?php
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