1--TEST--
2Test imap_base64() function : basic functionality
3--EXTENSIONS--
4imap
5--FILE--
6<?php
7echo "*** Testing imap_base64() : basic functionality ***\n";
8
9$str = 'This is an example string to be base 64 encoded';
10$base64 = base64_encode($str);
11if (imap_base64($base64) == $str) {
12    echo "TEST PASSED\n";
13} else {
14    echo "TEST FAILED";
15}
16
17$str = '!£$%^&*()_+-={][];;@~#?/>.<,';
18$base64 = base64_encode($str);
19if (imap_base64($base64) == $str) {
20    echo "TEST PASSED\n";
21} else {
22    echo "TEST FAILED";
23}
24
25$hex = 'x00\x01\x02\x03\x04\x05\x06\xFA\xFB\xFC\xFD\xFE\xFF';
26$base64 = base64_encode($hex);
27if (imap_base64($base64) == $hex) {
28    echo "TEST PASSED\n";
29} else {
30    echo "TEST FAILED";
31}
32
33?>
34--EXPECT--
35*** Testing imap_base64() : basic functionality ***
36TEST PASSED
37TEST PASSED
38TEST PASSED
39