1--TEST-- 2filter_var() and FILTER_SANITIZE_SPECIAL_CHARS 3--SKIPIF-- 4<?php if (!extension_loaded("filter")) die("skip"); ?> 5--FILE-- 6<?php 7 8var_dump(filter_var("?><!@#$%^&*()}{~Qwertyuilfdsasdfgmnbvcxcvbn", FILTER_SANITIZE_SPECIAL_CHARS)); 9var_dump(filter_var("<data&sons>", FILTER_SANITIZE_SPECIAL_CHARS)); 10var_dump(filter_var("", FILTER_SANITIZE_SPECIAL_CHARS)); 11 12var_dump(filter_var("?><!@#$%^&*()}{~Qwertyuilfdsasdfgmnbvcxcvbn", FILTER_SANITIZE_SPECIAL_CHARS, FILTER_FLAG_ENCODE_LOW)); 13var_dump(filter_var("<data&sons>", FILTER_SANITIZE_SPECIAL_CHARS, FILTER_FLAG_ENCODE_LOW)); 14var_dump(filter_var("", FILTER_SANITIZE_SPECIAL_CHARS, FILTER_FLAG_ENCODE_LOW)); 15 16var_dump(filter_var("?><!@#$%^&*()}{~Qwertyuilfdsasdfgmnbvcxcvbn", FILTER_SANITIZE_SPECIAL_CHARS, FILTER_FLAG_ENCODE_HIGH)); 17var_dump(filter_var("<data&sons>", FILTER_SANITIZE_SPECIAL_CHARS, FILTER_FLAG_ENCODE_HIGH)); 18var_dump(filter_var("", FILTER_SANITIZE_SPECIAL_CHARS, FILTER_FLAG_ENCODE_HIGH)); 19 20var_dump(filter_var("кириллица", FILTER_SANITIZE_SPECIAL_CHARS, FILTER_FLAG_ENCODE_HIGH)); 21var_dump(filter_var("кириллица", FILTER_SANITIZE_SPECIAL_CHARS, FILTER_FLAG_ENCODE_LOW)); 22 23echo "Done\n"; 24?> 25--EXPECT-- 26string(55) "?><!@#$%^&*()}{~Qwertyuilfdsasdfgmnbvcxcvbn" 27string(23) "<data&sons>" 28string(0) "" 29string(55) "?><!@#$%^&*()}{~Qwertyuilfdsasdfgmnbvcxcvbn" 30string(23) "<data&sons>" 31string(0) "" 32string(55) "?><!@#$%^&*()}{~Qwertyuilfdsasdfgmnbvcxcvbn" 33string(23) "<data&sons>" 34string(0) "" 35string(108) "кириллица" 36string(18) "кириллица" 37Done 38