How to remove the first n numeric characters from a string using PHP?

I have the line $str = "4sX3yY4mj2DT9gVOOS0x60onT08lwzLLZBqn8" . Now I want to remove the first 5 numeric characters from the string.

How to do this in php?

+5
source share
1 answer

Use the limit parameter with preg_replace :

 $str = preg_replace('~\d~', '', $str, 5); 
+9
source

Source: https://habr.com/ru/post/1262892/


All Articles