Longest Substring Without Repeating Characters - string functions

$string = 'hijklmnoabccasdfg';
var_dump(checkSubstring($string));

function checkSubstring($string) {
  $longest = $substring = '';
  $end = 0;

  for ($start = 0; $start < strlen($string); $start++) {

    $char = substr($string, $end, 1);
        
    while ($char && strpos($substring, $char) === false) {
      $substring .= $char;
      $end++;      
      $char = substr($string, $end, 1);
      
      if ($char == '') {
        
      }

    }
    
    if (strlen($substring) > strlen($longest)) {
      $longest = $substring;
    }
    
    if (strlen($substring) == strlen($string) || $char == '') {
      return $longest;
    }
    
    $substring = substr($substring, 1);
  }
  
  return $longest;
}
  
index array functions