1--TEST--
2Test strrev() function : usage variations - heredoc strings
3--FILE--
4<?php
5/* Testing strrev() function with heredoc strings for 'str' */
6
7echo "*** Testing strrev() function: with heredoc strings ***\n";
8$multi_line_str = <<<EOD
9Example of string
10spanning multiple lines
11using heredoc syntax.
12EOD;
13
14$special_chars_str = <<<EOD
15Ex'ple of h'doc st'g, contains
16$#%^*&*_("_")!#@@!$#$^^&*(special)
17chars.
18EOD;
19
20$control_chars_str = <<<EOD
21Hello, World\n
22Hello\0World
23EOD;
24
25$quote_chars_str = <<<EOD
26it's bright o'side
27"things in double quote"
28'things in single quote'
29this\line is /with\slashs
30EOD;
31
32$blank_line = <<<EOD
33
34EOD;
35
36$empty_str = <<<EOD
37EOD;
38
39$strings = array(
40  $multi_line_str,
41  $special_chars_str,
42  $control_chars_str,
43  $quote_chars_str,
44  $blank_line,
45  $empty_str
46);
47
48$count = 1;
49for( $index = 0; $index < count($strings); $index++ ) {
50  echo "\n-- Iteration $count --\n";
51  var_dump( strrev($strings[$index]) );
52  $count ++;
53}
54
55echo "*** Done ***";
56?>
57--EXPECTF--
58*** Testing strrev() function: with heredoc strings ***
59
60-- Iteration 1 --
61string(63) ".xatnys codereh gnisu
62senil elpitlum gninnaps
63gnirts fo elpmaxE"
64
65-- Iteration 2 --
66string(72) ".srahc
67)laiceps(*&^^$#$!@@#!)"_"(_*&*^%#$
68sniatnoc ,g'ts cod'h fo elp'xE"
69
70-- Iteration 3 --
71string(25) "dlroW%0olleH
72
73dlroW ,olleH"
74
75-- Iteration 4 --
76string(94) "shsals\htiw/ si enil\siht
77'etouq elgnis ni sgniht'
78"etouq elbuod ni sgniht"
79edis'o thgirb s'ti"
80
81-- Iteration 5 --
82string(0) ""
83
84-- Iteration 6 --
85string(0) ""
86*** Done ***
87