Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

--TEST-- Test ucwords() function : usage variations - heredoc strings --FILE-- <?php /* *..

Decoded Output download

*** Testing ucwords() : usage variations ***
-- Iteration 1 --

Did this file decode correctly?

Original Code

--TEST--
Test ucwords() function : usage variations - heredoc strings
--FILE--
<?php
/*
 * test ucwords() with different string prepared using heredoc
*/

echo "*** Testing ucwords() : usage variations ***\n";

// Null here doc string
$null_string = <<<EOT
EOT;

// Heredoc string with blank line
$blank_line = <<<EOT

EOT;

// here doc with multiline string
$multiline_string = <<<EOT
testing ucword() with
multiline string using
heredoc
EOT;

// here doc with different whitespaces
$diff_whitespaces = <<<EOT
testing\rucword(str)\twith
multiline   string\t\tusing
heredoc\nstring.with\vdifferent\fwhite\vspaces
EOT;

// here doc with numeric values
$numeric_string = <<<EOT
12sting 123string 4567
string\t123string\r12 test\n5test
EOT;

// heredoc with quote chars & slash
$quote_char_string = <<<EOT
it's bright,but i cann't see it.
"things in double quote"
'things in single quote'
this\line is /with\slashs
EOT;

$heredoc_strings = array(
  $null_string,
  $blank_line,
  $multiline_string,
  $diff_whitespaces,
  $numeric_string,
  $quote_char_string
);

// loop through $heredoc_strings element and check the working on ucwords()
$count = 1;
for($index =0; $index < count($heredoc_strings); $index ++) {
  echo "-- Iteration $count --\n";
  var_dump( ucwords($heredoc_strings[$index]) );
  $count ++;
}

echo "Done\n";
?>
--EXPECT--
*** Testing ucwords() : usage variations ***
-- Iteration 1 --
string(0) ""
-- Iteration 2 --
string(0) ""
-- Iteration 3 --
string(52) "Testing Ucword() With
Multiline String Using
Heredoc"
-- Iteration 4 --
string(93) "Testing
Ucword(str)	With
Multiline   String		Using
Heredoc
String.withDifferentWhiteSpaces"
-- Iteration 5 --
string(53) "12sting 123string 4567
String	123string
12 Test
5test"
-- Iteration 6 --
string(108) "It's Bright,but I Cann't See It.
"things In Double Quote"
'things In Single Quote'
This\line Is /with\slashs"
Done

Function Calls

count 1
ucwords 1

Variables

$count 1
$index 0
$blank_line
$null_string
$numeric_string 12sting 123string 4567 string 123string 12 test 5test
$heredoc_strings [{'key': 0, 'value': ''}, {'key': 1, 'value': '\n'}, {'key': 2, 'value': 'testing ucword() with\nmultiline string using\nheredoc\n'}, {'key': 3, 'value': 'testing\rucword(str)\twith\nmultiline string\t\tusing\nheredoc\nstring.with\x0bdifferent\x0cwhite\x0bspaces\n'}, {'key': 4, 'value': '12sting 123string 4567\nstring\t123string\r12 test\n5test\n'}, {'key': 5, 'value': 'it\'s bright,but i cann\'t see it.\n"things in double quote"\n\'things in single quote\'\nthis\\line is /with\\slashs\n'}]
$diff_whitespaces testing ucword(str) with multiline string using heredoc s..
$multiline_string testing ucword() with multiline string using heredoc
$quote_char_string it's bright,but i cann't see it. "things in double quote" 't..

Stats

MD5 861d07ec78e13f8107ba3ab8016f8837
Eval Count 0
Decode Time 78 ms