1--TEST--
2Test base64_encode() function : basic functionality
3--FILE--
4<?php
5/* Prototype  : proto string base64_encode(string str)
6 * Description: Encodes string using MIME base64 algorithm
7 * Source code: ext/standard/base64.c
8 * Alias to functions:
9 */
10
11/*
12 * Test base64_encode with single byte values.
13 */
14
15echo "*** Testing base64_encode() : basic functionality ***\n";
16
17for ($i=0; $i<256; $i++) {
18	$str = pack("c", $i);
19	$enc = base64_encode($str);
20	printf("0x%X: %s\n", $i, $enc);
21}
22
23echo "Done";
24?>
25--EXPECT--
26*** Testing base64_encode() : basic functionality ***
270x0: AA==
280x1: AQ==
290x2: Ag==
300x3: Aw==
310x4: BA==
320x5: BQ==
330x6: Bg==
340x7: Bw==
350x8: CA==
360x9: CQ==
370xA: Cg==
380xB: Cw==
390xC: DA==
400xD: DQ==
410xE: Dg==
420xF: Dw==
430x10: EA==
440x11: EQ==
450x12: Eg==
460x13: Ew==
470x14: FA==
480x15: FQ==
490x16: Fg==
500x17: Fw==
510x18: GA==
520x19: GQ==
530x1A: Gg==
540x1B: Gw==
550x1C: HA==
560x1D: HQ==
570x1E: Hg==
580x1F: Hw==
590x20: IA==
600x21: IQ==
610x22: Ig==
620x23: Iw==
630x24: JA==
640x25: JQ==
650x26: Jg==
660x27: Jw==
670x28: KA==
680x29: KQ==
690x2A: Kg==
700x2B: Kw==
710x2C: LA==
720x2D: LQ==
730x2E: Lg==
740x2F: Lw==
750x30: MA==
760x31: MQ==
770x32: Mg==
780x33: Mw==
790x34: NA==
800x35: NQ==
810x36: Ng==
820x37: Nw==
830x38: OA==
840x39: OQ==
850x3A: Og==
860x3B: Ow==
870x3C: PA==
880x3D: PQ==
890x3E: Pg==
900x3F: Pw==
910x40: QA==
920x41: QQ==
930x42: Qg==
940x43: Qw==
950x44: RA==
960x45: RQ==
970x46: Rg==
980x47: Rw==
990x48: SA==
1000x49: SQ==
1010x4A: Sg==
1020x4B: Sw==
1030x4C: TA==
1040x4D: TQ==
1050x4E: Tg==
1060x4F: Tw==
1070x50: UA==
1080x51: UQ==
1090x52: Ug==
1100x53: Uw==
1110x54: VA==
1120x55: VQ==
1130x56: Vg==
1140x57: Vw==
1150x58: WA==
1160x59: WQ==
1170x5A: Wg==
1180x5B: Ww==
1190x5C: XA==
1200x5D: XQ==
1210x5E: Xg==
1220x5F: Xw==
1230x60: YA==
1240x61: YQ==
1250x62: Yg==
1260x63: Yw==
1270x64: ZA==
1280x65: ZQ==
1290x66: Zg==
1300x67: Zw==
1310x68: aA==
1320x69: aQ==
1330x6A: ag==
1340x6B: aw==
1350x6C: bA==
1360x6D: bQ==
1370x6E: bg==
1380x6F: bw==
1390x70: cA==
1400x71: cQ==
1410x72: cg==
1420x73: cw==
1430x74: dA==
1440x75: dQ==
1450x76: dg==
1460x77: dw==
1470x78: eA==
1480x79: eQ==
1490x7A: eg==
1500x7B: ew==
1510x7C: fA==
1520x7D: fQ==
1530x7E: fg==
1540x7F: fw==
1550x80: gA==
1560x81: gQ==
1570x82: gg==
1580x83: gw==
1590x84: hA==
1600x85: hQ==
1610x86: hg==
1620x87: hw==
1630x88: iA==
1640x89: iQ==
1650x8A: ig==
1660x8B: iw==
1670x8C: jA==
1680x8D: jQ==
1690x8E: jg==
1700x8F: jw==
1710x90: kA==
1720x91: kQ==
1730x92: kg==
1740x93: kw==
1750x94: lA==
1760x95: lQ==
1770x96: lg==
1780x97: lw==
1790x98: mA==
1800x99: mQ==
1810x9A: mg==
1820x9B: mw==
1830x9C: nA==
1840x9D: nQ==
1850x9E: ng==
1860x9F: nw==
1870xA0: oA==
1880xA1: oQ==
1890xA2: og==
1900xA3: ow==
1910xA4: pA==
1920xA5: pQ==
1930xA6: pg==
1940xA7: pw==
1950xA8: qA==
1960xA9: qQ==
1970xAA: qg==
1980xAB: qw==
1990xAC: rA==
2000xAD: rQ==
2010xAE: rg==
2020xAF: rw==
2030xB0: sA==
2040xB1: sQ==
2050xB2: sg==
2060xB3: sw==
2070xB4: tA==
2080xB5: tQ==
2090xB6: tg==
2100xB7: tw==
2110xB8: uA==
2120xB9: uQ==
2130xBA: ug==
2140xBB: uw==
2150xBC: vA==
2160xBD: vQ==
2170xBE: vg==
2180xBF: vw==
2190xC0: wA==
2200xC1: wQ==
2210xC2: wg==
2220xC3: ww==
2230xC4: xA==
2240xC5: xQ==
2250xC6: xg==
2260xC7: xw==
2270xC8: yA==
2280xC9: yQ==
2290xCA: yg==
2300xCB: yw==
2310xCC: zA==
2320xCD: zQ==
2330xCE: zg==
2340xCF: zw==
2350xD0: 0A==
2360xD1: 0Q==
2370xD2: 0g==
2380xD3: 0w==
2390xD4: 1A==
2400xD5: 1Q==
2410xD6: 1g==
2420xD7: 1w==
2430xD8: 2A==
2440xD9: 2Q==
2450xDA: 2g==
2460xDB: 2w==
2470xDC: 3A==
2480xDD: 3Q==
2490xDE: 3g==
2500xDF: 3w==
2510xE0: 4A==
2520xE1: 4Q==
2530xE2: 4g==
2540xE3: 4w==
2550xE4: 5A==
2560xE5: 5Q==
2570xE6: 5g==
2580xE7: 5w==
2590xE8: 6A==
2600xE9: 6Q==
2610xEA: 6g==
2620xEB: 6w==
2630xEC: 7A==
2640xED: 7Q==
2650xEE: 7g==
2660xEF: 7w==
2670xF0: 8A==
2680xF1: 8Q==
2690xF2: 8g==
2700xF3: 8w==
2710xF4: 9A==
2720xF5: 9Q==
2730xF6: 9g==
2740xF7: 9w==
2750xF8: +A==
2760xF9: +Q==
2770xFA: +g==
2780xFB: +w==
2790xFC: /A==
2800xFD: /Q==
2810xFE: /g==
2820xFF: /w==
283Done
284