Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

LongestWord

<?php 

function LongestWord($sen) {

  $words = explode(" ", $sen);
  $longestWord = "";
  for($i = 0; $i < count($words); $i++){
    if(strlen($longestWord) < strlen($words[$i]) && !preg_match("/[W]/", $words[$i])){
      $longestWord = $words[$i];
    }
  }
  return $longestWord;

}
 
PREVIOUS NEXT
Tagged: #LongestWord
ADD COMMENT
Topic
Name
1+5 =