Last active
July 18, 2017 10:54
-
-
Save scamba/130979294140c4335e10af3ec78a481f to your computer and use it in GitHub Desktop.
Function library for strings (will be updated soon)
This file contains 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 characters
<?php | |
/* | |
-- ========================================================== | |
-- Author: Sergio Camba (https://github.com/scamba) | |
-- Technologies: PHP | |
-- Create date: 18/04/2017 | |
-- Description: Function library for strings | |
-- ========================================================== | |
*/ | |
/** | |
* changeWhitespaces( $text, $param ) | |
* | |
* Description: Function prepared to return the string with whitespace modified by the second parameter. | |
* | |
* @param $text (String) -> input string. | |
* @param $param (String) -> string to modified. | |
* | |
* @return (String) string $text with whitespace modified by $param. | |
*/ | |
function changeWhitespaces( $text, $param ) | |
{ | |
return str_replace( " ", $param, $text ); | |
} | |
echo changeWhitespaces( "Hello everybody i am here!", '-' ); | |
/** | |
* camelWritting( $text ) | |
* | |
* Description: Function prepared to return the string with camel writting. | |
* | |
* @param $text (String) -> input string. | |
* | |
* @return (String) string $text with camel writting. | |
*/ | |
function camelWritting( $text ) | |
{ | |
return ucwords( strtolower( $text ) ); | |
} | |
echo camelWritting( "Hello everybody i am here!", '-' ); | |
/** | |
* | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment