Jump to content

Archived

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

superhoops

Quick Question

Recommended Posts

Here is the code for my test page:

[code]<?php
$week = "3";
echo 'There are currently 10-$week weeks left before it is built.';
?>[/code]

But it displays this [b]There is currently 10-$week weeks left before it is built[/b]

Im a newbie and ive been p;layiong around with it but what i want to do it get it to work out 10 minus 3 ($week). What code do i need to do that?

Share this post


Link to post
Share on other sites
Hi,
[code]
<?php
$week = "3";
$val = 10 - $week;
echo 'There are currently: ".$val." weeks left before it is built.';
?>
[/code]

Share this post


Link to post
Share on other sites
For some reason with this code:

[code]
<?php
$week = "3";
$val = 10 - $week;
echo 'There are currently ".$val." weeks left before it is built.';
?>
[/code]

It only says this:

[b]There are currently ".$val." weeks left before it is built.[/b]

Share this post


Link to post
Share on other sites
I m sorry i didnt pay attention to your ' .

you should use ' instead of "

[code]
<?php
$week = "3";
$val = 10 - $week;
echo 'There are currently '.$val.' weeks left before it is built.';
?>
[/code]

Share this post


Link to post
Share on other sites

×

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.