mercredi 15 mai 2019

How to split repeated chars and numbers with preg_split?

I'm trying to solve some problem and I need to split repeated chars and all integers

$code = preg_split('/(.)(?!\1|$)\K/', $code);

I tried this one, but it separate and not repeated chars and not repeated integers , I need only chars

I have a string 'FFF86C6'

I need an array (FFF, 86, C, 6);

with pattern '/(.)(?!\1|$)\K/' returns (FFF, 8, 6, C, 6)

Do you have any idea how to make it?

Aucun commentaire:

Enregistrer un commentaire