Skip to content

Instantly share code, notes, and snippets.

@scamba
Last active July 18, 2017 10:54
Show Gist options
  • Save scamba/130979294140c4335e10af3ec78a481f to your computer and use it in GitHub Desktop.
Save scamba/130979294140c4335e10af3ec78a481f to your computer and use it in GitHub Desktop.
Function library for strings (will be updated soon)
<?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