I\'m confused by something I just ran into in a script I was working on. I had the following:
function getPart($part)
{
$array = array(\'a\', \'b\', \'c\');
PHP is a bit strange in that it treats a string in numeric comparison as 0. You can force string comparison by quoting the variables:
function getPart($part)
{
$array = array('a', 'b', 'c');
if ("$part" == 'first') $part = 0;
if ("$part" == 'last') $part = count($array) - 1;
if (isset($array[$part])) return $array[$part];
return false;
}