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

1.1       misho       1: --TEST--
                      2: Test chop() function : basic functionality 
                      3: --FILE--
                      4: <?php
                      5: /* Prototype  : string chop ( string $str [, string $charlist] )
                      6:  * Description: Strip whitespace (or other characters) from the end of a string
                      7:  * Source code: ext/standard/string.c
                      8: */
                      9: 
                     10: /*
                     11:  * Testing chop(): basic functionality
                     12: */
                     13: 
                     14: echo "*** Testing chop() : basic functionality ***\n";
                     15: 
                     16: // Initialize all required variables
                     17: $str = "hello world\t\n\r\0\x0B  ";
                     18: $charlist = 'dl ';
                     19: 
                     20: // Calling chop() with default arguments
                     21: var_dump( chop($str) );
                     22: 
                     23: // Calling chop() with all arguments
                     24: var_dump( chop($str, $charlist) );
                     25: 
                     26: // Calling chop() with the charlist not present at the end of input string
                     27: var_dump( chop($str, '!') );
                     28: 
                     29: echo "Done\n";
                     30: ?>
                     31: --EXPECTF--
                     32: *** Testing chop() : basic functionality ***
                     33: string(11) "hello world"
                     34: string(16) "hello world        
                     35: 
"
                     36: string(18) "hello world        
                     37: 
  "
                     38: Done

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