I
I
Islam Ibakaev2021-08-25 01:22:22
PHP
Islam Ibakaev, 2021-08-25 01:22:22

How to remove all zeros from the beginning of a string?

Can you please tell me a regular expression to remove all zeros from the beginning of a string.
The number of zeros can be different (0012345, 0000012345, 000000000000000012345).

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
dodo512, 2021-08-25
@devellopah

ltrim($str, '0')

V
Vitaly Khomenko, 2021-08-25
@iiifx

Catch another option in the piggy bank:
(string) (int) $str;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question