Showing posts with label join strings. Show all posts
Showing posts with label join strings. Show all posts

Tuesday, September 16, 2008

The strtouper() function

This function returns a given string in upper case.

Syntax: strtoupper(string);

Example input:

$str1=" my PrOgRam";
echo $str1;
echo "
";
echo strtoupper($str1);

Example output:

my PrOgRam
MY PROGRAM

Monday, September 15, 2008

The chunk_split() function

This function split a string into smaller strings.

Syntax: chunk_split(string,length,seperator);

length – the number of characters each smaller strings should contain.
seperator – this character will be inserted after every smaller string.
Example inputs:
$str1="A simple PHP Program";
echo chunk_split($str1,2,"@");

Saturday, September 13, 2008

Concatenation

In PHP, strings could be easily concatenated using the dot (.) operator.

Example inputs

$name=”Rick”;
echo “My name is “.$name;
2.
echo “My name is “.”Rick”;
3.
$str1 = “My name is”;
$str2 = “Rick”;
$str3 = $str1.$str2;

Example outputs

1.
My name is Rick.
2.
My name is Rick
3.
My name is Rick