- version_compare: documentation ( source)
- function_exists: documentation ( source)
- addslashes: documentation ( source)
- array_walk_recursive: documentation ( source)
<?php
if (!function_exists('get_magic_quotes_gpc') || !get_magic_quotes_gpc()) {
foreach (['_GET', '_POST', '_REQUEST', '_COOKIE'] as $var) {
array_walk_recursive($$var, function (&$value) {
$value = addslashes($value);
});
}
if (version_compare(PHP_VERSION, '5.4.0') < 0) {
set_magic_quotes_runtime(true);
}
}