This forum is now read-only. Please use our new forums! Go to forums

banner
Close banner
0 points
Submitted by Thomas de Beauchene
almost 11 years

Comparisons seem not to work

Hey, i don’t understand what’s wrong with that code:

<html>
  <head>
    <title>Comparing Numbers</title>
  </head>
  <body>
    <p>
      <?php
        9 == 9;
      ?>
    </p>
  </body>
</html>

I’ve tried many others but it always says “invalid comparison”, is it just a bug from the system ? i4ve tried with many others like 2 == 2;, 458 != 545; and all, but it never works. Does somebody have an answer ?

Answer 51da8f848c1ccc16be04af30

7 votes

Permalink

holy sh!t… is has to be:

points
Submitted by --..--
almost 11 years

4 comments

Audrey Bell almost 11 years

Thank you for telling us! They need to get the wording of the lesson fixed, then, geez.

Jacob Tooman almost 11 years

why does your example work in the editor but if I wrote

Sean Anderson over 10 years

this isn’t the first time I’ve noticed poor wording on this, but it isn’t just poor wording, they should have checked for maybe echo 5==5; or something different instead.

Pac44 almost 9 years

thanks

Answer 5242e43af10c60458b002d74

2 votes

Permalink

mine was:

  <?php
    3 < 5;
  ?>

It worked only after I removed the semi-colon

points
Submitted by haughmet
over 10 years

2 comments

carrielynnmusic over 10 years

same here.

zen over 10 years

same here and that’s really strange. especially after a lesson on the semicolon!

Answer 51da8c927c82ca47ca04ad26

0 votes

Permalink

Same problem here. It looks like you didn’t type a valid comparison.

points
Submitted by --..--
almost 11 years

2 comments

chiarachi over 10 years

it doesn’t work if you put a semicolon at the end of the comparison, like

Trey over 10 years

I’m not using a semicolon and it’s still giving me this error.

Answer 52a25c9e7c82cae9ca000771

0 votes

Permalink

It’s still buggy and or not worded correctly.

points
Submitted by Aaron Ausmus
over 10 years

Answer 52e2952180ff33cf0a00006e

0 votes

Permalink

i have run into the same problems. it doesn’t matter what i put its still wrong.

points
Submitted by agua305
about 10 years

Answer 520e90b5548c35fdee006904

-1 votes

Permalink

I don’t know why I didn’t think of your option. But, below code worked for me.

    if (6<7)
    {
    echo true;
    }
points
Submitted by Ruben
over 10 years

3 comments

Puneet Dhillon over 10 years

Yeah that same code worked for Me too!

zen over 10 years

no instruction to echo; no instruction to use “if” either

David Hutchison over 10 years

Next section is named “ Your first if”, which would seem to imply no “if” should be necessary for this exercise, which makes even weirder that excluding the semi-colon is he only way to get it to work,especially after a lesson on semi-colons.

Answer 529cb998abf82141ba01297a

-1 votes

Permalink

Awful instructions :( I had to read the Q&A to figure out what they were asking :(

points
Submitted by dshgna
over 10 years