tfburges
03-15-2010, 07:30 AM
alright so i'm talking about the following apostrophe:
’
not this one:
'
what's weird is that when i do the following:
$var = 'What’s this';
echo str_replace('’','',$var);
i get "Whats this" (as expected)
when i do this:
$array[] = 'What’s this';
if (in_array('What’s this', $array)) {
echo 'hmm';
}
i get "hmm" (as expected)
and when i do this:
$array1[] = 'What’s this';
$array2 = array('What’s this', 'What is that');
$array3 = array_diff($array2, $array1);
print_r($array3);
i get "Array ( [1] => What is that )" (as expected)
but when i do this:
<form method="post"><input type="text" name="heh[]"><input type="submit" value="submit"></form>
and enter "What’s this" as the input... and do this:
$array2 = array('What’s this', 'What is that');
$array3 = array_diff($array2, $_POST);
print_r($array3);
i get:
Array ( [0] => What’s this [1] => What is that ) (not as expected)
$_POST looks just like $array1 in the previous example...
and i've tried cycling through the array's and adding all combinations of stripslashes and addslashes to do the array_diff manually but to no avail...
typing up this topic (making these examples) has actually further verified my hypothesis that the value is modified by whatever method is used to create $_POST... but i can't figure out what it's changing
’
not this one:
'
what's weird is that when i do the following:
$var = 'What’s this';
echo str_replace('’','',$var);
i get "Whats this" (as expected)
when i do this:
$array[] = 'What’s this';
if (in_array('What’s this', $array)) {
echo 'hmm';
}
i get "hmm" (as expected)
and when i do this:
$array1[] = 'What’s this';
$array2 = array('What’s this', 'What is that');
$array3 = array_diff($array2, $array1);
print_r($array3);
i get "Array ( [1] => What is that )" (as expected)
but when i do this:
<form method="post"><input type="text" name="heh[]"><input type="submit" value="submit"></form>
and enter "What’s this" as the input... and do this:
$array2 = array('What’s this', 'What is that');
$array3 = array_diff($array2, $_POST);
print_r($array3);
i get:
Array ( [0] => What’s this [1] => What is that ) (not as expected)
$_POST looks just like $array1 in the previous example...
and i've tried cycling through the array's and adding all combinations of stripslashes and addslashes to do the array_diff manually but to no avail...
typing up this topic (making these examples) has actually further verified my hypothesis that the value is modified by whatever method is used to create $_POST... but i can't figure out what it's changing