skip navigation

Content:: PHP Array Strip Slashes Function

PHP - Array Strip Slashes Function

Array Strip Slashes is a simple function that makes use of a foreach loop and the stripslashes function. I mainly use this to bypass the magic quotes, if it is set, and remove the slashes so return reporting to the website can be completed. This of course must be counter acted with addslashes and parsing if you decide to input the data into a database. I would also highly recommend htmlspecialchars if you wish to send the output to a website, especially if you use GET or REQUEST variables.

This file must be included, I dislike the error return for includes and requests so I do it like this
if (file_exists("./inc/")) { include ("./inc/"); } else { echo 'failed to open'; exit;}

Next we use the funciton
if (get_magic_quotes_gpc())
	$_REQUEST = arrstripslashes($_REQUEST);
Download 1,576 bytes
MD5 - baeb84483a4c2fadf9cd3eada5d29bed *
Last Modified: 2012-10-21