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..

Can you not just cast the value to an integer?

(int)000007 = 7

cast your value using (int).

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

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

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

Member Avatar for rajarajan2017
$newvalue = (int)"00050";
echo $newvalue;

Just check it directly.

hahaha.. i got it. Thank u for u both

Member Avatar for rajarajan2017

Mark as solved! if it is solved!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.