PHP, Triming leading 0s problem
So here is the problem
I am getting a Hex number from a input filed
it could looks something like this
FFFF, 000CA3, blah blah blah
while trim these down is easy just with
$var = ltrim('0',$var);

My problem is when the user type in '0000' and such
it trims the whole string to nothing.
I could certainly do a if statement on that after the trim result check string become null and add a 0 if it does.
but is there any other neat trick out there can solve this like in one statement?
Thank you very much in advance.
PHP, Triming leading 0s problem
===

So here is the problem
I am getting a Hex number from a input filed
it could looks something like this
FFFF, 000CA3, blah blah blah
while trim these down is easy just with
$var = ltrim('0',$var);

My problem is when the user type in '0000' and such
it trims the whole string to nothing.
I could certainly do a if statement on that after the trim result check string become null and add a 0 if it does.
but is there any other neat trick out there can solve this like in one statement?
Thank you very much in advance.