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