1--TEST-- 2Test ucwords() function : usage variations - heredoc strings 3--FILE-- 4<?php 5/* Prototype : string ucwords ( string $str ) 6 * Description: Uppercase the first character of each word in a string 7 * Source code: ext/standard/string.c 8*/ 9 10/* 11 * test ucwords() with different string prepared using heredoc 12*/ 13 14echo "*** Testing ucwords() : usage variations ***\n"; 15 16// Null here doc string 17$null_string = <<<EOT 18EOT; 19 20// Heredoc string with blank line 21$blank_line = <<<EOT 22 23EOT; 24 25// here doc with multiline string 26$multiline_string = <<<EOT 27testing ucword() with 28multiline string using 29heredoc 30EOT; 31 32// here doc with different whitespaces 33$diff_whitespaces = <<<EOT 34testing\rucword(str)\twith 35multiline string\t\tusing 36heredoc\nstring.with\vdifferent\fwhite\vspaces 37EOT; 38 39// here doc with numeric values 40$numeric_string = <<<EOT 4112sting 123string 4567 42string\t123string\r12 test\n5test 43EOT; 44 45// heredoc with quote chars & slash 46$quote_char_string = <<<EOT 47it's bright,but i cann't see it. 48"things in double quote" 49'things in single quote' 50this\line is /with\slashs 51EOT; 52 53$heredoc_strings = array( 54 $null_string, 55 $blank_line, 56 $multiline_string, 57 $diff_whitespaces, 58 $numeric_string, 59 $quote_char_string 60); 61 62// loop through $heredoc_strings element and check the working on ucwords() 63$count = 1; 64for($index =0; $index < count($heredoc_strings); $index ++) { 65 echo "-- Iteration $count --\n"; 66 var_dump( ucwords($heredoc_strings[$index]) ); 67 $count ++; 68} 69 70echo "Done\n"; 71?> 72--EXPECT-- 73*** Testing ucwords() : usage variations *** 74-- Iteration 1 -- 75string(0) "" 76-- Iteration 2 -- 77string(0) "" 78-- Iteration 3 -- 79string(52) "Testing Ucword() With 80Multiline String Using 81Heredoc" 82-- Iteration 4 -- 83string(93) "Testing 83Ucword(str) With 84Multiline String Using 85Heredoc 86String.withDifferentWhiteSpaces" 87-- Iteration 5 -- 88string(53) "12sting 123string 4567 89String 123string 8912 Test 905test" 91-- Iteration 6 -- 92string(108) "It's Bright,but I Cann't See It. 93"things In Double Quote" 94'things In Single Quote' 95This\line Is /with\slashs" 96Done 97