So to see if we're understanding, your user is inputting 0001 and you are only getting 1, right? When, in fact you want 0001 out. Is that correct?
If so, you may want to look at the [man]str_pad[/man] function.
$numberin = "0001";
$numberout = str_pad($numberin, 4, 0, STR_PAD_LEFT);
echo $numberout;
If this isn't what you meant, please post more details.