Return to 002.phpt CVS log | Up to [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / tests / strings |
1.1 ! misho 1: --TEST-- ! 2: Formatted print functions ! 3: --FILE-- ! 4: <?php ! 5: error_reporting(0); ! 6: ! 7: $fp = fopen("php://stdout", "w") or die("Arrggsgg!!"); ! 8: $x = fprintf($fp, "fprintf test 1:%.5s", "abcdefghij"); ! 9: echo "\n"; ! 10: var_dump($x); ! 11: ! 12: printf("printf test 1:%s\n", "simple string"); ! 13: printf("printf test 2:%d\n", 42); ! 14: printf("printf test 3:%f\n", 10.0/3); ! 15: printf("printf test 4:%.10f\n", 10.0/3); ! 16: printf("printf test 5:%-10.2f\n", 2.5); ! 17: printf("printf test 6:%-010.2f\n", 2.5); ! 18: printf("printf test 7:%010.2f\n", 2.5); ! 19: printf("printf test 8:<%20s>\n", "foo"); ! 20: printf("printf test 9:<%-20s>\n", "bar"); ! 21: printf("printf test 10: 123456789012345\n"); ! 22: printf("printf test 10:<%15s>\n", "høyesterettsjustitiarius"); ! 23: printf("printf test 11: 123456789012345678901234567890\n"); ! 24: printf("printf test 11:<%30s>\n", "høyesterettsjustitiarius"); ! 25: printf("printf test 12:%5.2f\n", -12.34); ! 26: printf("printf test 13:%5d\n", -12); ! 27: printf("printf test 14:%c\n", 64); ! 28: printf("printf test 15:%b\n", 170); ! 29: printf("printf test 16:%x\n", 170); ! 30: printf("printf test 17:%X\n", 170); ! 31: printf("printf test 18:%16b\n", 170); ! 32: printf("printf test 19:%16x\n", 170); ! 33: printf("printf test 20:%16X\n", 170); ! 34: printf("printf test 21:%016b\n", 170); ! 35: printf("printf test 22:%016x\n", 170); ! 36: printf("printf test 23:%016X\n", 170); ! 37: printf("printf test 24:%.5s\n", "abcdefghij"); ! 38: printf("printf test 25:%-2s\n", "gazonk"); ! 39: printf("printf test 26:%2\$d %1\$d\n", 1, 2); ! 40: printf("printf test 27:%3\$d %d %d\n", 1, 2, 3); ! 41: printf("printf test 28:%2\$02d %1\$2d\n", 1, 2); ! 42: printf("printf test 29:%2\$-2d %1\$2d\n", 1, 2); ! 43: print("printf test 30:"); printf("%0\$s", 1); print("x\n"); ! 44: vprintf("vprintf test 1:%2\$-2d %1\$2d\n", array(1, 2)); ! 45: ! 46: ! 47: ?> ! 48: --EXPECT-- ! 49: fprintf test 1:abcde ! 50: int(20) ! 51: printf test 1:simple string ! 52: printf test 2:42 ! 53: printf test 3:3.333333 ! 54: printf test 4:3.3333333333 ! 55: printf test 5:2.50 ! 56: printf test 6:2.50000000 ! 57: printf test 7:0000002.50 ! 58: printf test 8:< foo> ! 59: printf test 9:<bar > ! 60: printf test 10: 123456789012345 ! 61: printf test 10:<høyesterettsjustitiarius> ! 62: printf test 11: 123456789012345678901234567890 ! 63: printf test 11:< høyesterettsjustitiarius> ! 64: printf test 12:-12.34 ! 65: printf test 13: -12 ! 66: printf test 14:@ ! 67: printf test 15:10101010 ! 68: printf test 16:aa ! 69: printf test 17:AA ! 70: printf test 18: 10101010 ! 71: printf test 19: aa ! 72: printf test 20: AA ! 73: printf test 21:0000000010101010 ! 74: printf test 22:00000000000000aa ! 75: printf test 23:00000000000000AA ! 76: printf test 24:abcde ! 77: printf test 25:gazonk ! 78: printf test 26:2 1 ! 79: printf test 27:3 1 2 ! 80: printf test 28:02 1 ! 81: printf test 29:2 1 ! 82: printf test 30:x ! 83: vprintf test 1:2 1