<?php //echo '<pre>';print_r($sArray);echo '</pre>';die; function findRepeatingStringCount($sArray) { $i = 0; $left = $sArray[0]; $right = $sArray[1]; while ($i < count($sArray)) { if ($left == $right) { return $i; } $i++; $right = $sArray[$i]; } return 0; } $s = "abcabcbb"; // string to array $sArray = str_split($s); echo '<pre>';print_r(findRepeatingStringCount($sArray));echo '</pre>';die;
You have javascript disabled. You will not be able to edit any code.