Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save alexandreelise/7463bd139c7bf53bcb2b177db27e7d1a to your computer and use it in GitHub Desktop.
Save alexandreelise/7463bd139c7bf53bcb2b177db27e7d1a to your computer and use it in GitHub Desktop.
Solution ucfirst bug when string is already in ALLCAPS in php one-liner
<?php
// Solution ucfirst bug when string is already in ALLCAPS
$result = (isset($givenString) && !empty(trim($givenString)) ? mb_ucfirst(mb_strtolower($givenString)) : '');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment