Walks the array while sanitizing the contents.

Signature

add_magic_quotes( $array )
array
 (array) Array to walk while sanitizing contents.

Return

(array) Sanitized $array.

Source

function add_magic_quotes( $array ) {
	foreach ( (array) $array as $k => $v ) {
		if ( is_array( $v ) ) {
			$array[$k] = add_magic_quotes( $v );
		} else {
			$array[$k] = addslashes( $v );
		}
	}
	return $array;
}
WP Trac GitHub

Link here