xref: /PHP-8.0/ext/iconv/tests/iconv002.phpt (revision c5401854)
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/*
15Expected output:
16&#97;&#98;&#99;&#100;
17abcd
18*/
19
20   $s = unpack("V*", iconv("ascii","UCS-4LE", "abcd"));
21   foreach($s as $c) { print "&#$c;"; } print "\n";
22
23   $s = pack("NNNN", 97, 98, 99, 100);
24   $q = iconv("UCS-4BE", "ascii", $s);
25   print $q; print "\n";
26?>
27--EXPECT--
28&#97;&#98;&#99;&#100;
29abcd
30