0

How do i assign the successive duplicate values of a string in a single offset of an array In PHP. For example FFF2AA

In array it should be

0=>FFF
1=>2
2=AA

In array format

gooyeduck
  • 13
  • 1

1 Answers1

1

This post Count consecutive occurence of specific, identical characters in a string - PHP gives you almost your perfect answer. you just have tu use '*' instead of '+' in the regex if you want to take into accounts 1 character strings (like the '2' above).

MarvinLeRouge
  • 444
  • 5
  • 15