2 /* Prototype : array iconv_mime_decode_headers(string headers [, int mode, string charset])
3 * Description: Decodes multiple mime header fields
4 * Source code: ext/iconv/iconv.c
8 * Pass different data types to $str argument to see how iconv_mime_decode_headers() behaves
11 echo "*** Testing iconv_mime_decode_headers() : usage variations ***\n";
13 // Initialise function arguments not being substituted
15 Subject: =?UTF-8?B?QSBTYW1wbGUgVGVzdA==?=
16 To: example@example.com
17 Date: Thu, 1 Jan 1970 00:00:00 +0000
18 Message-Id: <example@example.com>
19 Received: from localhost (localhost [127.0.0.1]) by localhost
20 with SMTP id example for <example@example.com>;
21 Thu, 1 Jan 1970 00:00:00 +0000 (UTC)
22 (envelope-from example-return-0000-example=example.com@example.com)
23 Received: (qmail 0 invoked by uid 65534); 1 Thu 2003 00:00:00 +0000
27 $mode = ICONV_MIME_DECODE_CONTINUE_ON_ERROR
;
31 //get an unset variable
38 public function __toString() {
39 return "Class A object";
48 // get a resource variable
49 $fp = fopen(__FILE__
, "r");
51 // unexpected values to be passed to $str argument
90 /*22*/ @$undefined_var,
99 // loop through each element of $inputs to check the behavior of iconv_mime_decode_headers()
101 foreach($inputs as $input) {
102 echo "\n-- Iteration $iterator --\n";
103 try { var_dump( iconv_mime_decode_headers($headers, $input, $charset)); } catch (Exception
$e) { echo "\n".'Warning: '.$e->getMessage().' in '.__FILE__
.' on line '.__LINE__
."\n"; }