I wrote a code.. but now I don't know which version is a better one.. Is there any possibility couse of 1st version my code is vulnerable?
Version 1:
$destination = $_POST['var'];
$destination = strip_tags(trim($destination));
Version 2:
$destination = strip_tags(trim($_POST['var']));
trimafterstrip_tags, 'cause you may still end up with whitespace on either side after you removed tags from your already trimmed string (for instance, with<p> <-- see the space after > </p>.