1--TEST-- 2Test htmlspecialchars_decode() function : usage variations - double quoted strings for 'string' argument 3--FILE-- 4<?php 5/* 6 * testing htmlspecialchars_decode() for various double quoted strings as argument for $string 7*/ 8echo "*** Testing htmlspecialchars_decode() : usage variations ***\n"; 9 10//double quoted strings 11$strings = array ( 12 "Roy's height > Sam's \$height... 1111 ≈ 0000 = 0000... " double quote string "", 13 "Roy's height > Sam's height... \t\t 13 < 15...\n\r " double quote\f\v string "", 14 "\nRoy's height >\t; Sam's\v height\f", 15 "\r\tRoy's height >\r; Sam\t's height", 16 "\n 1\t3 &\tgt; 11 but 11 &\tlt; 12", 17); 18 19// loop through each element of the array to check htmlspecialchars_decode() function with all possible arguments 20$iterator = 1; 21foreach($strings as $value) { 22 echo "-- Iteration $iterator --\n"; 23 var_dump( htmlspecialchars_decode($value) ); 24 var_dump( htmlspecialchars_decode($value, ENT_COMPAT) ); 25 var_dump( htmlspecialchars_decode($value, ENT_NOQUOTES) ); 26 var_dump( htmlspecialchars_decode($value, ENT_QUOTES) ); 27 $iterator++; 28} 29 30echo "Done"; 31?> 32--EXPECT-- 33*** Testing htmlspecialchars_decode() : usage variations *** 34-- Iteration 1 -- 35string(84) "Roy's height > Sam's $height... 1111 ≈ 0000 = 0000... " double quote string "" 36string(89) "Roy's height > Sam's $height... 1111 ≈ 0000 = 0000... " double quote string "" 37string(99) "Roy's height > Sam's $height... 1111 ≈ 0000 = 0000... " double quote string "" 38string(84) "Roy's height > Sam's $height... 1111 ≈ 0000 = 0000... " double quote string "" 39-- Iteration 2 -- 40string(72) "Roy's height > Sam's height... 13 < 15... 41 41 " double quote string "" 42string(82) "Roy's height > Sam's height... 13 < 15... 43 43 " double quote string "" 44string(92) "Roy's height > Sam's height... 13 < 15... 45 45 " double quote string "" 46string(72) "Roy's height > Sam's height... 13 < 15... 47 47 " double quote string "" 48-- Iteration 3 -- 49string(34) " 50Roy's height > ; Sam's height" 51string(44) " 52Roy's height > ; Sam's height" 53string(44) " 54Roy's height > ; Sam's height" 55string(34) " 56Roy's height > ; Sam's height" 57-- Iteration 4 -- 58string(34) " 58 Roy's height > 58; Sam 's height" 59string(44) " 59 Roy's height > 59; Sam 's height" 60string(44) " 60 Roy's height > 60; Sam 's height" 61string(34) " 61 Roy's height > 61; Sam 's height" 62-- Iteration 5 -- 63string(30) " 64 1 3 & gt; 11 but 11 & lt; 12" 65string(30) " 66 1 3 & gt; 11 but 11 & lt; 12" 67string(30) " 68 1 3 & gt; 11 but 11 & lt; 12" 69string(30) " 70 1 3 & gt; 11 but 11 & lt; 12" 71Done 72