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--EXPECTF--
40*** Testing mb_encode_mimeheader() : usage variations ***
41
42-- Iteration 1 --
43string(115) "=?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868?=
44 =?UTF-8?B?zrXOvc6/LiAwMTIzNDU2Nzg5Lg==?="
45
46-- Iteration 2 --
47string(114) "=?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868?=
48 =?UTF-8?B?zrXOvc6/LiAwMTIzNDU2Nzg5Lg==?="
49
50-- Iteration 3 --
51string(116) "=?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868?=--- =?UTF-8?B?zrXOvc6/LiAwMTIzNDU2Nzg5Lg==?="
52Done
53