Welcome Guest, Not a member yet? Register   Sign In
Convert.ToDouble(Price) in Codeigniter
#1

[eluser]bleu[/eluser]
I am converting asp.net code where
Code:
Convert.ToDouble(Price)
has been used .What will this statement look like in codeingiter.?
#2

[eluser]PhilTem[/eluser]
I don't exactly know what
Code:
Convert.ToDouble(Price)
does in ASP.net, but I think, it will convert anything to its corresponding double value? If I'm right, than you just have to

type cast

the variable.
And maybe read something about PHP principles before using a framework like CI Wink Just to get you going and not to get you down!
#3

[eluser]InsiteFX[/eluser]
PHP number_format
#4

[eluser]bleu[/eluser]
[quote author="InsiteFX" date="1331735516"]PHP number_format
[/quote]

should it be PHP round

something like
Code:
echo round($price);


as
Code:
Convert.ToDouble(Price)
Converts a specified value to a double-precision floating-point number. in .net

#5

[eluser]InsiteFX[/eluser]
Code:
// set your type - float same for double is depreciated
settype ( mixed &$var , string $type )

$price = settype(&$price, "float");

// format to currency
string money_format ( string $format , float $number )

// Similar format as above, adding the use of 2 digits of right
// precision and '*' as a fill character
echo money_format('%=*(#10.2n', $number) . "\n";

// ($********1,234.57)

// php round
float round ( float $val [, int $precision = 0 [, int $mode = PHP_ROUND_HALF_UP ]] )

Read the PHP Manual: Manual




Theme © iAndrew 2016 - Forum software by © MyBB