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