0

hi all,
i am having a doubt.How can i round off 005 to 5 and 000007 to 7 like this if the user enters in textbox.
please help me..

4
Contributors
7
Replies
8
Views
7 Years
Discussion Span
Last Post by rajarajan07
0

Can you not just cast the value to an integer?

(int)000007 = 7

Edited by blocblue: n/a

0

no actually i am having a textbox where we can allocate memory to user.so if i giv 00050 it is taking as it is. but actually i need it to take as 50

0

I guess name of textbox is userinput. so when you submit you form for processing in processing page you can trim the leading zeros by casting it.

<?php
	$newvalue=(int)$_REQUEST['userinput'];
?>

I guess you are asking for php solution as you have posted it in php forum

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.