Want to remove all 0
placed at the beginning of some variable.
Some options:
$var = 0002
, we should strip first 000
($var = 2
)var = 0203410
we should remove first 0
($var = 203410
)var = 20000
- do nothing ($var = 20000
)What is the solution?
Just cast it to integer
$var = (int)$var;