Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.