Skip to content

Instantly share code, notes, and snippets.

@lbvf50mobile
Last active October 15, 2020 12:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lbvf50mobile/6401d26307df911b87a11cc8442e0a59 to your computer and use it in GitHub Desktop.
Save lbvf50mobile/6401d26307df911b87a11cc8442e0a59 to your computer and use it in GitHub Desktop.
Just PHP FUN 129.
<?php
# https://www.codewars.com/kata/52449b062fb80683ec000024 The Hashtag Generator.
function generateHashtag($str) {
$str = trim($str);
if(0 == strlen($str)) return false;
$x = "#".preg_replace('/\s+/',"",ucwords($str));
if(140 < strlen($x)) return false;
return $x;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment