WernerK: Doppelte Backslahes, woher?

Beitrag lesen

Hallo,

ok, verstanden danke.
Abschliesend noch eine Frage bzw. Bitte.
Im Php Manual habe ich zum obigen Problem folgendes gefunden:

  
if (get_magic_quotes_gpc()) {  
    function stripslashes_deep($value)  
    {  
        $value = is_array($value) ?  
                    array_map('stripslashes_deep', $value) :  
                    stripslashes($value);  
  
        return $value;  
    }  
  
    $_POST = array_map('stripslashes_deep', $_POST);  
    $_GET = array_map('stripslashes_deep', $_GET);  
    $_COOKIE = array_map('stripslashes_deep', $_COOKIE);  
    $_REQUEST = array_map('stripslashes_deep', $_REQUEST);  
}  

Ich verstehe das nicht so ganz mit dem "array_map"
Warum wird das so kompliziert gemacht?

Wenn ich es so mache (in $val ist der Verzeichnispfad):

foreach ($_POST as $key => $val){
  if (get_magic_quotes_gpc()) {
   $val = stripslashes($val);
$dbInsertConfigdirectories->bindParam(':configdirectoriespath', $val);
    $dbInsertConfigdirectories->execute();

}
klappt es doch auch?

Gruss
Werner