Skip to content

Commit

Permalink
added dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
praisedpk authored Mar 15, 2017
1 parent 9fdbe66 commit 25723aa
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions converter.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,31 @@ function number_to_word( $num = '' )
}
return '';
}

function trim_all( $str , $what = NULL , $with = ' ' )
{
if( $what === NULL )
{
// Character Decimal Use
// "\0" 0 Null Character
// "\t" 9 Tab
// "\n" 10 New line
// "\x0B" 11 Vertical Tab
// "\r" 13 New Line in Mac
// " " 32 Space

$what = "\\x00-\\x20"; //all white-spaces and control chars
}

return trim( preg_replace( "/[".$what."]+/" , $with , $str ) , $what );
}

function str_replace_last( $search , $replace , $str ) {
if( ( $pos = strrpos( $str , $search ) ) !== false ) {
$search_length = strlen( $search );
$str = substr_replace( $str , $replace , $pos , $search_length );
}
return $str;
}


0 comments on commit 25723aa

Please sign in to comment.