mercredi 30 septembre 2015

If a $var1 equals a string then set $var2 equal to another string

Basically if $var1 = 'Refi' then I want $var2 = 'Refinance'. If $var = 'Purch' or 'Purchase' then I need $var2 = 'Purchase'.

$var2 = '';

if (!(strcasecmp($var1, 'Refi') === false)) {
$var2 = 'Refinance';
}

if (!(strcasecmp($var1, 'Purch') === false) || !(strcasecmp($var1, 'Purchase') === false)) {
$var2 = 'Purchase';
}

The output I am getting is just defaulting to 'Purchase'. I also need the strings to be case insensitive. I don't know what is going on with it, the logic seems correct in my help.

Aucun commentaire:

Enregistrer un commentaire