2 /* Prototype : string wordwrap ( string $str [, int $width [, string $break [, bool $cut]]] )
3 * Description: Wraps buffer to selected number of characters using string break char
4 * Source code: ext/standard/string.c
8 * test wordwrap() by supplying different values for cut argument
11 echo "*** Testing wordwrap() : usage variations ***\n";
12 // initialize all required variables
13 $str = 'testing wordwrap function';
17 // get an unset variable
22 $fp = fopen(__FILE__
, "r");
24 // array with different values
45 array('color' => 'red', 'item' => 'pen'),
65 // loop though each element of the array and check the working of wordwrap()
66 // when $cut arugment is supplied with different values
67 echo "\n--- Testing wordwrap() by supplying different values for 'cut' argument ---\n";
69 for($index = 0; $index < count($values); $index ++
) {
70 echo "-- Iteration $counter --\n";
71 $cut = $values [$index];
73 var_dump( wordwrap($str, $width, $break, $cut) );