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

0 points
Submitted by Nat Colley
over 10 years

This just isn't right

I have found several people with similar issues on this exercise but none of their solutions (like leaving out all the extra “ and . or using print instead of echo work for me. Here is what I have:

 function aboutme($name, $age) {
      echo "Hello! My names is " . $name . " and I am " . $age . " years old.";
  }
  aboutme("Nat", "21");
    ?>

Hello! My names is Nat and I am 21 years old.

Oops, try again! It looks like your code printed ‘Hello! My names is Nat and I am 21 years old.’ instead of ‘Hello! My name is [your name here] and I am [your age here] years old.’

This has got to be a bug, but the better question is why no one fixes it.

Answer 5229f47ef10c601bfc003f05

2 votes

Permalink

It should be My name is, you wrote My names is.

points
Submitted by Juan Diego
over 10 years

2 comments

Nat Colley over 10 years

Well, that was it. So thank you, but I still think the error message could have been a little more enlightening and specific.

Nick Samuel over 10 years

Agreed, the academy error messages are very hit and miss!

Answer 52433fecf10c608868000a6c

1 vote

Permalink

I’m getting the same error, here’s my code <?php function aboutMe($name, $age) { echo “Hello! My name is “ . $name . “ and I am “ . $age . “ years old.”; } aboutMe(“Anne Marie”, 22);

    ?>

and the error message is

Oops, try again! It looks like your code printed ‘Hello! My name is Anne Marie and I am 22 years old.’ instead of ‘Hello! My name is [your name here] and I am [your age here] years old.’

points
Submitted by annemarieny
over 10 years

2 comments

Aden Fission over 10 years

The SCT has trouble with multi-word names. Using “Anne” or “Marie’ individually should do the trick.

Robin James over 10 years

ADEN: This was the best explanation of the problem using two words. thanks!

Answer 5245829a548c35164d000c64

0 votes

Permalink

I am getting the very same error. I have checked probably ten times now to make sure the strings match perfectly.

'Hello! My name is ' . $name . ' and I am ' . $age . ' years old.';

I still get the exact same error :/

points
Submitted by Clayton Hunsinger
over 10 years

1 comments

Aden Fission over 10 years

Your function is okay, but you might be passing in two words as your name in the function call, which messes up the SCT.

Answer 52539871548c353f11003d9b

0 votes

Permalink

Its work

    <?php
    function aboutMe($name,$age){
       echo "Hello! My name is ". $name . ", and I am ". $age . "years old.";
    }
    
    aboutMe("Ahmad Muhajir", 21)
  
    ?>
points
Submitted by Muhajir Knight
over 10 years