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

banner
Close banner
0 points
Submitted by Aurélien Roux
about 11 years

2.4 Variable: What's wrong?

Hi,

i’m stuck on exercice 2.4 here is my code

    <body>
    <p><?php $myFirstVariable = 10-10; echo $myFirstVariable; ?></p>
</body>

and I always have the same result:

Oops, try again. Did you remember to set $myFirstVariable to 0? Don’t forget the semicolon!

What am I missing there?

thanks

Answer 5138906b6a90a0ef750031ca

2 votes

Permalink

I found I needed to use Amal Muralis trick -

If your code is correct and you don’t get any output: Hit Ctrl + F5.

As the web page just did nothing after clicking submit before that!

points
Submitted by js2025
about 11 years

Answer 513594eabb1ec57df00018cf

1 vote

Permalink

points
Submitted by Abdul Shahid
about 11 years

2 comments

Aurélien Roux about 11 years

thought we had to do a calculation here!! thanks!

Yee Joo over 10 years

thanks =)

Answer 521095aeabf8210eea000a80

1 vote

Permalink

Your code is this:

<p><?php $myFirstVariable = 10-10; echo $myFirstVariable; ?></p>

I passed with this:

<p><?php $myFirstVariable = 0; ?></p>

Hope this works!

points
Submitted by ninjakid
over 10 years

1 comments

ninjakid over 10 years

Advice: Make your code as simple as possible

Answer 513816da6c2b984d3e00046d

0 votes

Permalink

the result i got is PHP Notice: Undefined variable: myFirstVariable in /root/adapter/runners/runner.php(47) : eval()’d code on line 9. also it notice don’t forget the semicolon!

points
Submitted by xillixx
about 11 years

1 comments

xillixx about 11 years

done. reset back and type back the code solve the problem.

Answer 51383e3d36c7f2a992001425

0 votes

Permalink

Don’t forget to print it exactly, as in myFirstVariable instead of myfirstvariable in all lower case, took me while to work that one out !

points
Submitted by Andy Turner
about 11 years

Answer 51388c5f8c170125d8003076

0 votes

Permalink

see my answer for ths exercise. i got the answer

points
Submitted by Abdul Shahid
about 11 years

Answer 5139a1ad4739bdc04f00124f

0 votes

Permalink

2.4 and 2.5 are broken and won’t work if you follow the instructions. I’ll learn PHP elsewhere.

points
Submitted by Simon O. Shahan
about 11 years

1 comments

Simon O. Shahan about 11 years

Came back the next day and reran the same code. No problem!

Answer 5148c3e2c2df13dc0a000461

0 votes

Permalink

Before you submit, just click in the tab to see the result. If don’t work report the trouble

points
Submitted by Marlon da Veiga
about 11 years