Last active
September 17, 2022 11:59
-
-
Save tidusvn05/449444ca7c22c19bf3b54434bd7ef5ab to your computer and use it in GitHub Desktop.
Revisions
-
tidusvn05 revised this gist
Sep 17, 2022 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -4,7 +4,7 @@ * Uppercase to lowercase and lowercase to uppercase(ASCII string only). * * @param string $value :x * @return string */ function invertCase($value) { -
tidusvn05 created this gist
Sep 17, 2022 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,15 @@ <?php /** * Uppercase to lowercase and lowercase to uppercase(ASCII string only). * * @param string $value * @return string */ function invertCase($value) { return strtolower($value) ^ strtoupper($value) ^ $value; } // echo invertCase("Invert My CASE"); // => iNVERT mY case This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,22 @@ <?php /** * Right trim string. * * @param string $value * @param bool $fullsize * @return string */ // function rtrim($value, $fullsize = true) // { // if ($fullsize) { // $value = preg_replace('/[\s]+$/u', '', $value); // } // return $value; // } echo 'aaaa '; echo rtrim('aaaa '); echo rtrim('aaaa '); This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,22 @@ <?php /** * Convert a value to studly caps case. * * * @param string $value * @return string StudlyCaseString */ function studlyCase($value) { $words = explode(' ', str_replace(['-', '_'], ' ', $value)); $studlyWords = array_map(function ($word) { return ucfirst($word); }, $words); return implode($studlyWords); } // echo studlyCase("studly Case string"); // => StudlyCaseString