1--TEST--
2Test mb_encode_mimeheader() function : usage variations - Pass different strings to $linefeed arg
3--SKIPIF--
4<?php
5extension_loaded('mbstring') or die('skip');
6function_exists('mb_encode_mimeheader') or die("skip mb_encode_mimeheader() is not available in this build");
7?>
8--FILE--
9<?php
10/* Prototype  : string mb_encode_mimeheader
11 * (string $str [, string $charset [, string $transfer_encoding [, string $linefeed [, int $indent]]]])
12 * Description: Converts the string to MIME "encoded-word" in the format of =?charset?(B|Q)?encoded_string?=
13 * Source code: ext/mbstring/mbstring.c
14 */
15
16/*
17 * Pass different strings to $linefeed argument
18 */
19
20echo "*** Testing mb_encode_mimeheader() : usage variations ***\n";
21
22mb_internal_encoding('utf-8');
23
24$linefeeds = array("\r\n",
25                   "\n",
26                   "---");
27$str = base64_decode('zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868zrXOvc6/LiAwMTIzNDU2Nzg5Lg==');
28
29$iterator = 1;
30foreach ($linefeeds as $linefeed) {
31	echo "\n-- Iteration $iterator --\n";
32	var_dump(mb_encode_mimeheader($str, 'utf-8', 'B', $linefeed));
33	$iterator++;
34}
35
36
37echo "Done";
38?>
39
40--EXPECTF--
41*** Testing mb_encode_mimeheader() : usage variations ***
42
43-- Iteration 1 --
44string(115) "=?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868?=
45 =?UTF-8?B?zrXOvc6/LiAwMTIzNDU2Nzg5Lg==?="
46
47-- Iteration 2 --
48string(114) "=?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868?=
49 =?UTF-8?B?zrXOvc6/LiAwMTIzNDU2Nzg5Lg==?="
50
51-- Iteration 3 --
52string(116) "=?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868?=--- =?UTF-8?B?zrXOvc6/LiAwMTIzNDU2Nzg5Lg==?="
53Done
54