Return to fgetss1.phpt CVS log | Up to [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / standard / tests / file |
1.1 misho 1: --TEST-- 2: more fgetss() tests 3: --FILE-- 4: <?php 5: 6: $filename = dirname(__FILE__)."/fgetss1.html"; 7: 8: $array = array( 9: "askasdfasdf<b>aaaaaa\n</b>dddddd", 10: "asdqw<i onClick=\"hello();\">\naaaa<>qqqq", 11: "aaa<script>function foo() {}</script>qqq", 12: "asdasd<a\n asdjeje", 13: "", 14: "some text \n<b>blah</i>", 15: "some another text <> hoho </>" 16: ); 17: 18: foreach ($array as $str) { 19: file_put_contents($filename, $str); 20: $fp = fopen($filename, "r"); 21: var_dump(fgetss($fp, 1000, "<i>,<b>,<a>")); 22: var_dump(fgetss($fp)); 23: } 24: 25: foreach ($array as $str) { 26: file_put_contents($filename, $str); 27: $fp = fopen($filename, "r"); 28: var_dump(fgetss($fp, 10)); 29: var_dump(fgetss($fp, 10, "<script>,<a>")); 30: } 31: 32: @unlink($filename); 33: 34: echo "Done\n"; 35: ?> 36: --EXPECTF-- 37: string(21) "askasdfasdf<b>aaaaaa 38: " 39: string(6) "dddddd" 40: string(28) "asdqw<i onClick="hello();"> 41: " 42: string(8) "aaaaqqqq" 43: string(23) "aaafunction foo() {}qqq" 44: bool(false) 45: string(6) "asdasd" 46: string(0) "" 47: bool(false) 48: bool(false) 49: string(11) "some text 50: " 51: string(4) "blah" 52: string(24) "some another text hoho " 53: bool(false) 54: string(9) "askasdfas" 55: string(6) "dfaaaa" 56: string(5) "asdqw" 57: string(0) "" 58: string(3) "aaa" 59: string(9) "t>functio" 60: string(6) "asdasd" 61: string(0) "" 62: bool(false) 63: bool(false) 64: string(9) "some text" 65: string(2) " 66: " 67: string(9) "some anot" 68: string(9) "her text " 69: Done