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

1.1       misho       1: --TEST--
                      2: Test bin2hex() function : basic functionality 
                      3: --FILE--
                      4: <?php
                      5: 
                      6: /* Prototype  : string bin2hex  ( string $str  )
                      7:  * Description: Convert binary data into hexadecimal representation
                      8:  * Source code: ext/standard/string.c
                      9: */
                     10: 
                     11: echo "*** Testing bin2hex() : basic functionality ***\n";
                     12: 
                     13: // array with different values for $string
                     14: $strings =  array (
                     15: 
                     16:                  //double quoted strings
                     17: /*1*/    "Here is a simple string",
                     18:                  "\t This String contains \t\t some control characters\r\n",
                     19:                  "\x90\x91\x00\x93\x94\x90\x91\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f",
                     20:                  
                     21:                   //single quoted strings
                     22: /*4*/    'Here is a simple string',
                     23:                  '\t This String contains \t\t some control characters\r\n',
                     24:                  '\x90\x91\x00\x93\x94\x90\x91\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f',
                     25: );  
                     26: 
                     27: // loop through with each element of the $strings array to test bin2hex() function
                     28: $count = 1;
                     29: foreach($strings as $string) {
                     30:   echo "-- Iteration $count --\n";     
                     31:   var_dump(bin2hex($string));
                     32:   $count ++;
                     33: }  
                     34: ?>
                     35: ===DONE===
                     36: --EXPECT--
                     37: *** Testing bin2hex() : basic functionality ***
                     38: -- Iteration 1 --
                     39: string(46) "4865726520697320612073696d706c6520737472696e67"
                     40: -- Iteration 2 --
                     41: string(102) "09205468697320537472696e6720636f6e7461696e7320090920736f6d6520636f6e74726f6c20636861726163746572730d0a"
                     42: -- Iteration 3 --
                     43: string(36) "9091009394909195969798999a9b9c9d9e9f"
                     44: -- Iteration 4 --
                     45: string(46) "4865726520697320612073696d706c6520737472696e67"
                     46: -- Iteration 5 --
                     47: string(112) "5c74205468697320537472696e6720636f6e7461696e73205c745c7420736f6d6520636f6e74726f6c20636861726163746572735c725c6e"
                     48: -- Iteration 6 --
                     49: string(144) "5c7839305c7839315c7830305c7839335c7839345c7839305c7839315c7839355c7839365c7839375c7839385c7839395c7839615c7839625c7839635c7839645c7839655c783966"
                     50: ===DONE===

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