The forum of the forums
Would you like to react to this message? Create an account in a few clicks or log in to continue.

whats wrong with this? (php)

2 posters

Go down

whats wrong with this? (php) Empty whats wrong with this? (php)

Post by Metorrite February 18th 2013, 10: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, 10:55 pm; edited 1 time in total
avatar
Metorrite
Forumember

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

http://meteorscape.forumotion.com

Back to top Go down

whats wrong with this? (php) Empty Re: whats wrong with this? (php)

Post by Sir Chivas™ February 18th 2013, 10: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™
Sir Chivas™
Helper
Helper

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

Back to top Go down

whats wrong with this? (php) Empty Re: whats wrong with this? (php)

Post by Metorrite February 18th 2013, 10:43 pm

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

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

http://meteorscape.forumotion.com

Back to top Go down

Back to top

- Similar topics

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