PDA

View Full Version : preg_replace, more than 4



dreami0
10 Mar 2011, 12:11 AM
I have a string contains sequences of 0 and 1. I need to replace all zero sequences whose length less than 5, into number 1 with same length. The zero sequences with length 5 or more should be left as is.

For example

source : 11000001100010011000001
result : 11000001111111111000001


Code:
http://cc78.freephptest.com/