Jump to content

[SOLVED] if statement error


EchoFool

Recommended Posts

I am stuck with my php because my if statement is checking if the two values are the same "numerically" rather than if its string.. as the string consists of numbers its taking is number checking rather than string checking:

 

<?php
$X = 1;
$Y = 0;
$MyX = 00;
$MyY = 10;

$Check = '$X$Y';
$Check2 = '$MyXMyY';
If($Check == $Check2){
Echo 'ok';
}
?>

 

 

So its basically saying:

10 is equal to 0010

 

Which is correct in numerical world but im trying use them as strings but it keeps just auto using it as numbers, how do tell it to check if they are the same strings ignoring their numerical value?

Link to comment
https://forums.phpfreaks.com/topic/153052-solved-if-statement-error/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.