stripslashes_deep

Definition:
function stripslashes_deep($value) {}

Navigates through an array and removes slashes from the values.
If an array is passed, the array_map() function causes a callback to pass the value back to the function. The slashes from this value will removed.

Parameters

  • array|string $value: The array or string to be stripped.

Return values

returns:Stripped array (or string in the callback).

Source code

function stripslashes_deep($value) {

	if ( is_array($value) ) {

		$value = array_map('stripslashes_deep', $value);

	} elseif ( is_object($value) ) {

		$vars = get_object_vars( $value );

		foreach ($vars as $key=>$data) {

			$value->{$key} = stripslashes_deep( $data );

		}

	} else {

		$value = stripslashes($value);

	}



	return $value;

}

2919

No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: