I'm setting a variable to 1 or 2 and than later I want to check to see if the variable is 2 to execute an if statement but not sure I have the syntax right
if( $card_number=2 )
{
Do this
}
So above this $card_number will be set to either 1 or 2 and I'm trying to do an if statement that if it is 2 than perform this, but the way I have it doesn't seem to be working.
You are assigning the value 2 to $card_number by using "=". You have to use "==" or "===".
"==" -> check value regardless of the type. So (string) "2" == 2 will be true, but "2" === 2 will be false.