Annotation of embedaddon/php/ext/standard/tests/strings/strip_tags_basic1.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: Test strip_tags() function : basic functionality - with default arguments
                      3: --INI--
                      4: short_open_tag = on
                      5: --FILE--
                      6: <?php
                      7: /* Prototype  : string strip_tags(string $str [, string $allowable_tags])
                      8:  * Description: Strips HTML and PHP tags from a string 
                      9:  * Source code: ext/standard/string.c
                     10: */
                     11: 
                     12: echo "*** Testing strip_tags() : basic functionality ***\n";
                     13: 
                     14: // array of arguments 
                     15: $string_array = array (
                     16:   "<html>hello</html>",
                     17:   '<html>hello</html>',
                     18:   "<?php echo hello ?>",
                     19:   '<?php echo hello ?>',
                     20:   "<? echo hello ?>",
                     21:   '<? echo hello ?>',
                     22:   "<% echo hello %>",
                     23:   '<% echo hello %>',
                     24:   "<script language=\"PHP\"> echo hello </script>",
                     25:   '<script language=\"PHP\"> echo hello </script>',
                     26:   "<html><b>hello</b><p>world</p></html>",
                     27:   '<html><b>hello</b><p>world</p></html>',
                     28:   "<html><!-- COMMENT --></html>",
                     29:   '<html><!-- COMMENT --></html>'
                     30: );
                     31:   
                     32:                
                     33: // Calling strip_tags() with default arguments
                     34: // loop through the $string_array to test strip_tags on various inputs
                     35: $iteration = 1;
                     36: foreach($string_array as $string)
                     37: {
                     38:   echo "-- Iteration $iteration --\n";
                     39:   var_dump( strip_tags($string) );
                     40:   $iteration++;
                     41: }
                     42: 
                     43: echo "Done";
                     44: ?>
                     45: --EXPECTF--
                     46: *** Testing strip_tags() : basic functionality ***
                     47: -- Iteration 1 --
                     48: string(5) "hello"
                     49: -- Iteration 2 --
                     50: string(5) "hello"
                     51: -- Iteration 3 --
                     52: string(0) ""
                     53: -- Iteration 4 --
                     54: string(0) ""
                     55: -- Iteration 5 --
                     56: string(0) ""
                     57: -- Iteration 6 --
                     58: string(0) ""
                     59: -- Iteration 7 --
                     60: string(0) ""
                     61: -- Iteration 8 --
                     62: string(0) ""
                     63: -- Iteration 9 --
                     64: string(12) " echo hello "
                     65: -- Iteration 10 --
                     66: string(12) " echo hello "
                     67: -- Iteration 11 --
                     68: string(10) "helloworld"
                     69: -- Iteration 12 --
                     70: string(10) "helloworld"
                     71: -- Iteration 13 --
                     72: string(0) ""
                     73: -- Iteration 14 --
                     74: string(0) ""
                     75: Done

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>