in reply to (jeffa) Re: Rearranging a string
in thread Rearranging a string
jeffa: you were getting empty elements because the two-character pairs are being used as delimiters, with empty elements between them.$s='0102030405060A0BC' # Fix to even number of chars $s.=(length($s)%2?"F":"") for($i=0; $i<length($s); $i+=2) { substr($s,$i,2)=reverse(substr($s,$i,2)); }
--ZZamboni
|
|---|