1--TEST-- 2Test imap_base64() function : basic functionality 3--SKIPIF-- 4<?php 5extension_loaded('imap') or die('skip imap extension not available in this build'); 6?> 7--FILE-- 8<?php 9/* Prototype : string imap_base64 ( string $text ) 10 * Description: Decode BASE64 encoded text. 11 * Source code: ext/imap/php_imap.c 12 */ 13 14echo "*** Testing imap_base64() : basic functionality ***\n"; 15 16$str = 'This is an example string to be base 64 encoded'; 17$base64 = base64_encode($str); 18if (imap_base64($base64) == $str) { 19 echo "TEST PASSED\n"; 20} else { 21 echo "TEST FAILED"; 22} 23 24$str = '!£$%^&*()_+-={][];;@~#?/>.<,'; 25$base64 = base64_encode($str); 26if (imap_base64($base64) == $str) { 27 echo "TEST PASSED\n"; 28} else { 29 echo "TEST FAILED"; 30} 31 32$hex = 'x00\x01\x02\x03\x04\x05\x06\xFA\xFB\xFC\xFD\xFE\xFF'; 33$base64 = base64_encode($hex); 34if (imap_base64($base64) == $hex) { 35 echo "TEST PASSED\n"; 36} else { 37 echo "TEST FAILED"; 38} 39 40?> 41===Done=== 42--EXPECT-- 43*** Testing imap_base64() : basic functionality *** 44TEST PASSED 45TEST PASSED 46TEST PASSED 47===Done=== 48