'My function returns same data without do the jobs

I have made function like below to remove html tags and special characters from the string.

function input_filter_data($data) {
        $data= trim($data);
        $data= stripslashes($data);
        $data= htmlspecialchars($data);
        $data= strip_tags($data);
        return $data;
}

and I am trying to use it like below

$affiliate_id =input_filter_data("Hello <b><i>world!</i></b>","<i>");

echo $affiliate_id;

But its giving me same result like

Hello <b><i>world!</i></b>","<i>

But if I use simple like

echo strip_tags("Hello <b><i>world!</i></b>","<i>");

then its removing all html tags from string.

I am not getting idea why its happening like this, let me know if anyone here can help me for solve the puzzle.

Thanks!

php


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source