Youss
Youss

Reputation: 4212

Mutiple filter options for one variable

I'm doing a get request with variable:

$url = $_GET['url'];

Now I would like to add some filtering option:

$url = (filter_var($_GET['url'], FILTER_SANITIZE_URL));

How do I include another filter option: FILTER_SANITIZE_STRING

Putting them next to each other doesn't work. I tried with array that also didn't work.

Upvotes: 0

Views: 59

Answers (2)

samayo
samayo

Reputation: 16495

Why even sacrifice clarity for non-beneficial approach? Just keep it clear, simple.

$url = filter_var($_GET['url'], FILTER_SANITIZE_URL);
$final = filter_var($url, FILTER_SANITIZE_STRING);

Upvotes: 1

user557846
user557846

Reputation:

how about:

$url = filter_var(filter_var($_GET['url'], FILTER_SANITIZE_URL),FILTER_SANITIZE_STRING);

Upvotes: 1

Related Questions