note 21023 modified in function.stripslashes by torben

From: Date: Thu, 25 Apr 2002 18:26:46 +0000
Subject: note 21023 modified in function.stripslashes by torben
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-29845@lists.php.net to get a copy of this message
Wouldn't be better to make it like this to prevent non-string values to be modified to string values? function stripslashes_array(&$array) { while (list($key) = each($array)) { if (is_array($array[$key])) { stripslashes_array($array[$key]); } elseif (is_string($array[$key])) { $array[$key] = stripslashes($array[$key]); } } } --was-- Wouldn't be better to make it like this to prevent non-string values to be modified to string values? function stripslashes_array(&$array) { while (list($key) = each($array)) { if (is_array($array[$key])) { stripslashes_array($array[$key]); } elseif (is_string($array[$key])) { $array[$key] = stripslashes($array[$key]); } } } http://www.php.net/manual/en/function.stripslashes.php

« previous php.notes (#29845) next »