Uridium Posted February 17, 2009 Posted February 17, 2009 im working on a way so staff can alter currency via the staff panel rather than files problem is i cant get this line to do what i want it to do.. function money_formatter($muny,$symb='$') i want to remove the $ and make it so it selects a pre-defined outcome... function money_formatter($muny,$symb='{$set['game_currency']}') i get parse errors with this method however so what woud be the correct way to do it. Parse error: syntax error, unexpected T_STRING, expecting ')' in C:\xampp\htdocs\global_func.php on line 2 Quote
POG1 Posted February 17, 2009 Posted February 17, 2009 Re: money_formatter on MCCODES V2 money_formatter($value) { global $set; return $set['game_currencey'] .' '. number_format($value); } Quote
Uridium Posted February 17, 2009 Author Posted February 17, 2009 Re: money_formatter on MCCODES V2 Cheers POG that worked 1st attempt :) Thank you +1 Quote
Haunted Dawg Posted February 17, 2009 Posted February 17, 2009 Re: money_formatter on MCCODES V2 Or this. function money_formatter($value, $currency = '$') { return $currency.number_format($value); } To call it: money_formatter($ir['money'], 'symbol'); Quote
Floydian Posted February 17, 2009 Posted February 17, 2009 Re: money_formatter on MCCODES V2 To provide a reason that didn't work, you can't have square brackets as part of the function signature. function blah($foo[$umm]) The [$umm] part just can't be added in. I doubt that $foo->umm would work either. Quote
Haunted Dawg Posted February 17, 2009 Posted February 17, 2009 Re: money_formatter on MCCODES V2 Was that directed at me or at who? Quote
Floydian Posted February 17, 2009 Posted February 17, 2009 Re: money_formatter on MCCODES V2 the topic creator ;) Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.