1--TEST-- 2Test ucwords() function : usage variations - single quoted string 3--FILE-- 4<?php 5/* 6 * test ucwords() with different string prepared using single quote 7*/ 8 9echo "*** Testing ucwords() : usage variations ***\n"; 10 11// different strings containing regular chars and special chars 12$str_array = array( 13 // multiple spaces 14 'testing ucwords', 15 't e s t i n g u c w o r d s ', 16 17 // brackets in sentence 18 'testing function(ucwords)', 19 '(testing ( function (ucwords) )a )test', 20 '(t)', 21 ' ( t )t', 22 23 // using quote chars in sentence 24 '"testing",ucword,"test"', 25 '"t""t",test, t', 26 '\'t \'t\',test', 27 28 // using other white spaces 29 '\ttesting\ttesting\tucwords', 30 'testing\rucwords testing ucwords', 31 'testing\fucwords \f testing \nucwords', 32 '\ntesting\nucwords\n testing \n ucwords', 33 'using\vvertical\vtab', 34 35 //using special chars in sentence 36 't@@#$% %test ^test &test *test +test -test', 37 '!test ~test `test` =test= @test@test.com', 38 '/test/r\test\ucwords\t\y\y\u\3 \yy\ /uu/', 39 40 //only special chars 41 '!@#$%^&*()_+=-`~' 42); 43 44// loop through the $str_array array to test ucwords on each element 45$iteration = 1; 46for($index = 0; $index < count($str_array); $index++) { 47 echo "-- Iteration $iteration --\n"; 48 var_dump( ucwords($str_array[$index]) ); 49 $iteration++; 50} 51 52echo "Done\n"; 53?> 54--EXPECT-- 55*** Testing ucwords() : usage variations *** 56-- Iteration 1 -- 57string(18) "Testing Ucwords" 58-- Iteration 2 -- 59string(30) "T E S T I N G U C W O R D S " 60-- Iteration 3 -- 61string(25) "Testing Function(ucwords)" 62-- Iteration 4 -- 63string(38) "(testing ( Function (ucwords) )a )test" 64-- Iteration 5 -- 65string(3) "(t)" 66-- Iteration 6 -- 67string(7) " ( T )t" 68-- Iteration 7 -- 69string(23) ""testing",ucword,"test"" 70-- Iteration 8 -- 71string(14) ""t""t",test, T" 72-- Iteration 9 -- 73string(11) "'t 't',test" 74-- Iteration 10 -- 75string(27) "\ttesting\ttesting\tucwords" 76-- Iteration 11 -- 77string(32) "Testing\rucwords Testing Ucwords" 78-- Iteration 12 -- 79string(37) "Testing\fucwords \f Testing \nucwords" 80-- Iteration 13 -- 81string(39) "\ntesting\nucwords\n Testing \n Ucwords" 82-- Iteration 14 -- 83string(20) "Using\vvertical\vtab" 84-- Iteration 15 -- 85string(42) "T@@#$% %test ^test &test *test +test -test" 86-- Iteration 16 -- 87string(40) "!test ~test `test` =test= @test@test.com" 88-- Iteration 17 -- 89string(40) "/test/r\test\ucwords\t\y\y\u\3 \yy\ /uu/" 90-- Iteration 18 -- 91string(16) "!@#$%^&*()_+=-`~" 92Done 93