Antivirus
05-07-2010, 07:32 PM
Ok this is driving me nuts... all common sense tells me this should work however it does not.
$oldname = 'Tiger';
$newname = 'TigerXXX';
$options = array(
[0] => 'Cat'
[1] => 'Cow'
[2] => 'Monkey'
[3] => 'Snake'
[4] => 'Tiger'
[5] => 'Zebra'
);
if($key = array_search($oldname, $options))
{
$options[$key] = trim(unhtmlspecialchars($newname));
asort($options);
}
By all accounts, 'Tiger' should be replaced with 'TigerXXX'... shouldn't it? This is what I am expecting but it's not working out. Seems that array_search() is returning false.
Anyone know why?
$oldname = 'Tiger';
$newname = 'TigerXXX';
$options = array(
[0] => 'Cat'
[1] => 'Cow'
[2] => 'Monkey'
[3] => 'Snake'
[4] => 'Tiger'
[5] => 'Zebra'
);
if($key = array_search($oldname, $options))
{
$options[$key] = trim(unhtmlspecialchars($newname));
asort($options);
}
By all accounts, 'Tiger' should be replaced with 'TigerXXX'... shouldn't it? This is what I am expecting but it's not working out. Seems that array_search() is returning false.
Anyone know why?