summaryrefslogtreecommitdiff
path: root/ext/standard/tests/url/base64_decode_basic_001.phpt
blob: 232a0a6f715b7a6c04bcef9993b5fa39c770507a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
--TEST--
Test base64_decode() function : basic functionality - ensure all base64 alphabet is supported.
--FILE--
<?php
/* Prototype  : proto string base64_decode(string str[, bool strict])
 * Description: Decodes string using MIME base64 algorithm
 * Source code: ext/standard/base64.c
 * Alias to functions:
 */

echo "Decode an input string containing the whole base64 alphabet:\n";
$allbase64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/VV==";
var_dump(bin2hex(base64_decode($allbase64)));
var_dump(bin2hex(base64_decode($allbase64, false)));
var_dump(bin2hex(base64_decode($allbase64, true)));

echo "Done";
?>
--EXPECTF--
Decode an input string containing the whole base64 alphabet:
string(98) "00108310518720928b30d38f41149351559761969b71d79f8218a39259a7a29aabb2dbafc31cb3d35db7e39ebbf3dfbf55"
string(98) "00108310518720928b30d38f41149351559761969b71d79f8218a39259a7a29aabb2dbafc31cb3d35db7e39ebbf3dfbf55"
string(98) "00108310518720928b30d38f41149351559761969b71d79f8218a39259a7a29aabb2dbafc31cb3d35db7e39ebbf3dfbf55"
Done