What wrong with this program? It is not working.........
function trimfunc($number) { $trimmed = ltrim($number, "0"); return $trimmed; //outputs 460 } echo "The trimmed value is".trimfunc(0045); ?>
Madhu
8:30 am on Jul 12, 2007 (gmt 0)
Plz help..........
Habtom
8:33 am on Jul 12, 2007 (gmt 0)
function trimfunc($number) { $trimmed = ltrim($number, "0"); return $trimmed; } $input = "0045"; echo "The trimmed value is ". trimfunc($input);
tomda
8:36 am on Jul 12, 2007 (gmt 0)
Try using number_format and not ltrim...
If I am not wrong, ltrim() is a string-function so it is not the best function to use since a number is a number and not a tring. number_format is a number-function.
I can't test your code today, my PC is down...
Habtom
8:39 am on Jul 12, 2007 (gmt 0)
Try using number_format() as Tomda mentioned, ltrim is more of for strings and not for numbers as such.
Madhu
8:41 am on Jul 12, 2007 (gmt 0)
Very tanx for u both...... My code is now working.. I am new to php & to this forum Tell me were is the log out link for this forum
tomda
8:46 am on Jul 12, 2007 (gmt 0)
Glad it works! To log out, go to your control panel and click on signout