The forum of the forums
Welcome to the Official Support Forum of Forumotion!

To take full advantage of everything offered by our forum, please log in if you are already a member, or join our community if you've not yet.



Create a free forum like this one.

whats wrong with this? (php)

View previous topic View next topic Go down

whats wrong with this? (php)

Post by Metorrite on February 18th 2013, 4:27 pm

whats wrong with this php? im trying to learn php and im not sure what im doing wrong. im using this site as my sandbox paste and copy the code in to see my error please.
site: sandbox.onlinephpfunctions.com/
Code:

<?php

static $g;
$m = 6;
$o = 4;
$n = 2

Function money() {
global $g, $m, $o, $n;
$g=$m * $o / $n;
}

function dividemoney() {
global $g, $n;
$g=$g / $n;
}

money();
echo $g;
dividemoney();
echo $g;

?>

the end answer should be 6. and the result sohuld look like

12
6



EDIT: fixed forgot a semi-colon. Solved.


Last edited by Metorrite on February 18th 2013, 4:55 pm; edited 1 time in total

Metorrite
Forumember

Posts : 52
Reputation : 1
Language : English | HTML | C++

http://meteorscape.forumotion.com

Back to top Go down

Re: whats wrong with this? (php)

Post by Sir Chivas™ on February 18th 2013, 4:31 pm

Hi,

I tried it and I believe that this is the error,
<br />
<b>Parse error</b>: syntax error, unexpected '<' in <b>[...][...]</b> on line <b>2</b><br />

Sir Chivas™
Support Moderator
Support Moderator

Male Posts : 6783
Reputation : 430
Language : EN, FR, ES
Location : || CSS || HTML || Graphics Designs || Support ||

Back to top Go down

Re: whats wrong with this? (php)

Post by Metorrite on February 18th 2013, 4:43 pm

yes that is my problem i don understand what is wrong though. Sad

Metorrite
Forumember

Posts : 52
Reputation : 1
Language : English | HTML | C++

http://meteorscape.forumotion.com

Back to top Go down

View previous topic View next topic Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum