I am having an array
$array = array("ab","aab","abb","abab","abaab","abbb");
I want to search the elements that contain duplicate consecutive characters like aab
, abb
, abbb
and replace them with 1
.
Conversely, if an element does not contain any duplicate consecutive characters, (like ab
and abab
) then it should be replaced with 0
.