...

View Full Version : Php + -



IamHe
10-16-2009, 05:29 PM
Hi, quick post, im just tryna figure out how to plus and subtract etc using php.

cant find any tutorials.

for example heres what i want to do


<?

$MAGICNUMBER = 1+5 ;

?>

<? echo "$magicnumber" ?>

just wondering if any body knows of a tutuorial or could show me how that should be set out.

would be appreciated.

thanks Allot in advance

Liam:)

mlseim
10-16-2009, 05:36 PM
What you're doing is OK, but the variables must be the same (caps and small letters).
You have one all caps, the other all small ... which is incorrect.

To increment the variable, both of these produce the same result:

$magicnumber = $magicnumber + 1;
$magicnumber++;

Pay attention to case-sensitivity ... your variables.

EDIT:
Not all webhosts are set-up the same for PHP, in regards to <?

You may be able to do this ...
<?
// code
?>

or you may have to do this ...
<?php
// code
?>

IamHe
10-16-2009, 05:55 PM
THANKS ALLOT :)

i know that php is usually case sensitive, i just missed the fact id wrote one in caps and one without, i must have had caps on for some other reason.

i knew that could be done, and assume that's how i should do it, but when it didnt work i just assumed id done it wrong and couldnt find a tutorial

again, thanks for your help :)

Liam:)

met
10-16-2009, 06:24 PM
this is great to start off http://www.tizag.com/phpT/



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum