Monday 29 September 2014

wordwrap in PHP

PHP strtok() function is utilized to split a string into smaller strings(tokens).

Syntax:

strtok(string,split)
string : Required. Specifies the string to split

split : Required. Specifies the string characters token delimiters.

Example:

<?php
$str_name = "Good morning. Have a nice day.";
$token_name = strtok($str_name," ");
while($token_name != false){
     echo "$token_name <br />";
     $token_name = strtok(" ");
}
?>
Output will be:
Good
morning.
Have
a
nice
day.
*****************************************************************
 PHP strtolower() function returns an all-lowercase string, regardless of whether the original was all uppercase or mixed.

Syntax:

strtolower(string)
string : Required. Specifies the input string.

Example:

<?php
echo strtolower("Good Morning World!");
?>
Output will be:
good morning world!
*****************************************************************
PHP strtoupper() function returns an all-uppercase string, regardless of whether the original was all lowercase or mixed.

 Syntax:

strtoupper(string)
Example:

<?php
 echo strtoupper("Good Morning World!");
?>
Output will be:
GOOD MORNING WORLD!
*****************************************************************
PHP strtr() function is utilized to interpret certain characters in a string.

Syntax:

strtr(string,from,to)
Or

strtr(string,array)
string : Required. Specifies the string to interpret.

from : Required (unless array is utilized). Holds characters to be translated.

to : Required (unless array is utilized). Holds characters to be translated with.

array : Required (to and from is used). An array holding what to change from as key, and what to change to as value.

Note : If from and to are different length, both will be formatted to the length of the shortest.

Example:

<?php
echo strtr("Hoad Marning","Ha","Go");
$arr_name = array("Good" => "Good", "Morning" => "Night");
echo strtr("Good Morning",$arr_name);
?>
Output will be:
Good Morning
Good Night
*****************************************************************
PHP substr() function is utilized to get a part of a string from a string, beginning at a specified position.

Syntax:

substr(string,start,length)
string : Required.  Specifies the string to return a part of

start : Required.Specifies where to begin in the string.

A positive number – begin at a specified position in the string.
A negative number – begin  at a specified position from the end of the string.
 0 – begin  at the first character in string.
length : Optional. Specifies the length of the returned string. Default is to end of the string.

A positive number – The length to be returned from the start parameter.
 Negative number – he length to be returned from the finish of the string
Note: If begin is a negative number and length is less than or equal to begin, length gets 0.

Example:

<?php
$input_str  = "Good Morning!";
echo substr($input_str,5);
echo substr($input_str,5,7);
?>
Output will be:
Morning!
Morning
*****************************************************************
PHP substr_compare() function is utilized to analyze two strings from a specified starting position.

Function Returns :

 0 – If the two strings are equal
 <0 – If the string1 (from startpos) is less than string2
>0 – If the string1 (from startpos) is greater than string2
Syntax:

substr_compare(string1,string2,startpos,length,case)
string1 : Required. Specifies the first string being compared

string2 : Required. Specifies the second string being compared

startpos : Required. Specifies where to begin comparing in string1

length : Optional. Specifies how much of string1 to compare

case : Optional. Specifies whether or not to perform a case-sensitive compare. Default is FALSE (case-sensitive)

Tip : PHP substr_compare() function is binary safe and alternatively case-sensitive.

Example:

<?php
$input_str  = "Good Morning!";
echo substr_compare($input_str,"Good Morning!",0)."<br />";
echo substr_compare($input_str,"Morning!",5)."<br />";
echo substr_compare($input_str,"MORNING!",5,TRUE);
?>
Output will be:
0
0
0
*****************************************************************
 PHP substr_count() function will count the number of times a substring is found in a string.

Syntax:

substr_count(string,substring,start,length)
string : Required. Specifies the string to check

substring : Required. Specifies the string to search for

start : Optional. Specifies where to in string to begin searching

length : Optional. Specifies the length of the search

Example:

<?php
$input_str  = "Good morning. Have a nice day!";
echo substr_count($input_str,"nice");
?>
Output will be:
1
*****************************************************************
PHP substr_replace() function is utilized to swap a part of a string with another string or words.

Syntax:

substr_replace(string,replacement,start,length)
string : Required. Specifies the string to operate

replacement : Required. Specifies the string to replace

start : Required. Specifies where to start position of the substring to replace

A positive number – Start replacing at the specified position in the string
A negative number – Start replacing at the specified position from the end of the string
0 – Start replacing at the first character in string
 length : Optional. Specifies the length of the string segment to be replaced. Default is the same length as the string.

A positive number – The length of string to be replaced
Negative number – How many characters should be left at end of the string after replacing
0 – Insert instead of replace
Note : If begin is a negative number and length is less than or equivalent to begin, length gets 0.

Example:

<?php
$input_str  = "Good Morning!";
echo substr_replace($input_str,"Night",5);
?>
Output will be:
Good Night!
*****************************************************************
PHP trim() function is utilized to strip out white space (or different characters) from the beginning and end of a string.

Syntax:

trim(string, charlist)
string : Required. Specifies the string to check

charlist : Optional. Specifies which character to remove from the string.

If not specified all of the following characters will be removed :

"\0" – NULL
"\t" – tab
"\n" – new line
"\x0B" – vertical tab
"\r" – carriage return
" " – ordinary white space
Example:

<?php
$input_str= "\n\rGood Morning!\n\r";
echo "Without trim : ". $input_str;
echo "<br />";
echo "With trim : ". trim($input_str);
?>
Output will be:
Without trim : Good Morning!
 With trim : Good Morning!
If You Select "View Source" in the browser window, you will see the following HTML :

<html>
<body>
Without trim : 

Good Morning!

<br />With trim : Good Morning!
</body>
</html>
*****************************************************************
PHP ucfirst() function is capitalizes only the first letter of a string.

Syntax:

ucfirst(string)
string : Required. Specifies the string to convert

Example:

<?php
$input_str  = "good morning!";
echo ucfirst($input_str);
?>
Output will be:
Good morning!
*****************************************************************
PHP ucwords() function is capitalizes the first letter of each word in a string.

Syntax:

ucwords(string)
string : Required. Specifies the string to convert

Example:

<?php
$input_str  = "good morning!";
echo ucwords($input_str);
?>
Output will be:
Good Morning!
*****************************************************************
PHP vfprintf() function is used to write a formatted string to a specified output stream.

PHP vfprintf() function returns the length of the written string.

Syntax:

vfprintf(stream,format,argarray)
stream : Required. Specifies where to write/output the string

format : Required. Specifies the string and how to format the variables in it.

Possible format values:

%% - Returns a percent sign
%b - Binary number
%c - The character according to the ASCII value
%d - Signed decimal number
%e - Scientific notation (e.g. 1.2e+2)
%u - Unsigned decimal number
%f - Floating-point number (local settings aware)
%F - Floating-point number (not local settings aware)
%o - Octal number
%s - String
%x - Hexadecimal number (lowercase letters)
%X - Hexadecimal number (uppercase letters)
Additional format values. These are placed between the % and the letter (example %.2f) :

+ (Forces both + and - in front of numbers. By default, only negative numbers are marked)
' (Specifies what to use as padding. Default is space. Must be used together with the width specifier. Example: %'x20s (this uses "x" as padding)
- (Left-justifies the variable value)
[0-9] (Specifies the minimum width held of to the variable value)
.[0-9] (Specifies the number of decimal digits or maximum string length)

Note : If multiple additional format values are used, they must be in the same order as above.
argarray : Required. An array with arguments to be inserted at the % signs in the format string.

Note : If there are more % signs than arguments, you must use placeholders. A placeholder is inserted after the % sign, and consists of the argument- number and "\$".

Tip : Related functions: fprintf(), printf(), sprintf(), vprintf(), and vsprintf().

Example:

<?php 
$input_str = "Good";
$input_number = 330;
$file_name = fopen("test.txt","w");
echo vfprintf($file_name,"%s Morning. It is day number %u",array($input_str,$input_number));
?>
Output will be:
34
The following text will be written to the file "test.txt":

Good Morning. It is day number 330
*****************************************************************
PHP vprintf () function is utilized to display array values as a formatted string.
The PHP vprintf () function Operates as printf() but accepts an array of arguments, instead of a variable number of arguments.

Syntax:

vprintf(stream,format,argarray)
stream : Required. Specifies where to write/output the string

format : Required. Specifies the string and how to format the variables in it.

Possible format values:

%% - Returns a percent sign
%b - Binary number
%c - The character according to the ASCII value
%d - Signed decimal number
%e - Scientific notation (e.g. 1.2e+2)
%u - Unsigned decimal number
%f - Floating-point number (local settings aware)
%F - Floating-point number (not local settings aware)
%o - Octal number
%s - String
%x - Hexadecimal number (lowercase letters)
%X - Hexadecimal number (uppercase letters)
Additional format values. These are put between the % and the letter (example %.2f) :

+ (Forces both + and -before numbers. By default, just negative numbers are marked)
'(Specifies what to utilize as padding. Default is space. Must be utilized together with the width specifier. Illustration: %'x20s (this utilization "x" as padding)
-(Left-supports the variable value)
[0-9] (Specifies the minimum width expected of to the variable value)
[0-9] (Specifies the number of decimal digits or most extreme string length)

Note : If multiple additional format values are utilized, they must be in the same request as above.
argarray : Required. An array with arguments to be inserted at the % signs in the format string

Note : If there are more % signs than arguments, you should use placeholders. A placeholder is inserted after the % sign, and consists of the argument number and "\$".

Tip : Related functions: fprintf(), printf(), sprintf(), vfprintf() and vsprintf().

Example:

<?php 
$input_str = "Good";
$input_number = 330;
echo vprintf("%s Morning. It is day number %u",array($input_str,$input_number));
?>
Output will be:
Good Morning. It is day number 330
*****************************************************************
vsprintf () function is utilized to write a formatted string to a variable.

The PHP vsprintf () function Operates as sprintf() but accepts an array of arguments, instead of a variable number of arguments.

Syntax:

vsprintf(stream,format,argarray)
stream : Required. Specifies where to write/output the string

format : Required. Specifies the string and how to format the variables in it.

Possible format values:

%% - Returns a percent sign
%b - Binary number
%c - The character according to the ASCII value
%d - Signed decimal number
%e - Scientific notation (e.g. 1.2e+2)
%u - Unsigned decimal number
%f - Floating-point number (local settings aware)
%F - Floating-point number (not local settings aware)
%o - Octal number
%s - String
%x - Hexadecimal number (lowercase letters)
%X - Hexadecimal number (uppercase letters)
Additional format values. These are placed between the % and the letter (example %.2f) :

+ (Forces both + and - in front of numbers. By default, only negative numbers are marked)
' (Specifies what to use as padding. Default is space. Must be used together with the width specifier. Example: %'x20s (this uses "x" as padding)
- (Left-justifies the variable value)
[0-9] (Specifies the minimum width held of to the variable value)
.[0-9] (Specifies the number of decimal digits or maximum string length)
Note:  If various additional format values are utilized, they must be in the same request as above.
argarray : Required. A array with arguments to be embedded at the % signs in the format string.

Note : If there are more % signs than arguments, you should use placeholders. A placeholder is inserted after the % sign, and consists of the argument number and "\$".

Tip : Related functions: fprintf(), printf(), sprintf(), vfprintf(), and vprintf().

Example:

<?php 
$input_str = "Good";
$input_number = 330;
$res_txt = vsprintf($file_name,"%s Morning. It is day number %u",array($input_str,$input_number));
echo $res_txt;
?>
Output will be:
Good Morning. It is day number 330
*****************************************************************
PHP wordwrap() function is utilized to wraps a sentence into new lines using a string break character.

Syntax:

wordwrap(string,width,break,cut)
string : Required. Specifies the string to split into lines.

width : Optional. Specifies the greatest line width. Default is 75.

break : Optional. Specifies the characters to utilize as break. Default is "\n".

cut : Optional. Specifies if statements longer than the specified width should be wrapped. Default is FALSE (no-wrap).

Note : PHP wordwrap function may leave white spaces at the starting of a line.

Example:

<?php
$str = "Welcome to online php guide.";
$newtext= wordwrap($str,22,"<br />\n");
echo $newtext;
?>
Output will be:
Welcome to online php
guide.
*****************************************************************

strstr in PHP

PHP strstr() function is utilized to searches its first string argument to see if its second string argument is contained in it. Returns the substring of the first string that starts with the first instance of the second argument, if any is found – otherwise, it returns false. 

Syntax:

strstr(string,search)
string : Required. Specifies the input string.

search : Required.Specifies the string to search for.

Note : PHP strstr() function is binary-safe.

Note : PHP strstr() function is case-sensitive. For case-insensitive search, use PHP stristr() function.

Example:

<?php
echo strstr("Good Morning world!","Morning");
echo "<br /><strong> Example using ASCII code for search : </strong><br />";
echo strstr("Good Morning",111);
?>
Output will be:
Morning world!
Example using ASCII code for search :
ood Morning

strspn in PHP

PHP strspn() function is utilized to get the amount of characters that considered in the principle string that holds only characters from character listed in the second string.

Syntax:

strspn(string,charlist,start,length)
string : Required. Defines the input string to search

charlist : Required. Defines the characters to search for

start : Optional. Defines where in string to start

length : Optional. Defines the length of the string (how much of the string to search).

Note : This function is binary safe.

Example:

<?php
echo strspn("Good Morning","crnMiu");
?>
Output will be:
5

strrpos in PHP

PHP strrpos() function searches backward from end of the string, rather than forward from the beginning. The search string must only be one character long and there is no optional position argument. Returns FALSE if match not found.

Syntax:

strrpos(string,find,start)
string : Required. Specifies the string to examined.

find : Required. Specifies the string to find

start : Optional. Specifies starting position of the first string.

Note : This function is case-sensitive.

Example:

<?php
echo strrpos("Good Morning","o");
?>
Output will be:
6

strripos in PHP

 PHP strripos() function is utilized to discover the position of the final occurrence of a case-insensitive string in a string. Returns FALSE if match not found.

Syntax:

strripos(string,find,start)
string : Required. Specifies the string to examined.

find : Required. Specifies the string to find

start : Optional.Specifies starting position of the first string.

Note : This function is case-insensitive.

Example:

<?php
echo strripos("Good Morning","oR");
?>
Output will be:
6

strrev in PHP

PHP strrev() function is used to returned the string with characters reversed.

Syntax:

strrev(string)
string : Required. Specifies the input string to reverse.

Example:

<?php
$str_name = "Good Morning";
echo strrev($str_name);
?>
Output will be:
gninroM dooG

strrchr in PHP

PHP strrchr() function is utilized to find the position of the final occurrence of a string inside another string(main string).
If char cannot be found, this function returns FALSE.

Syntax:

strrchr(string,char)
string : Required. Specifies the string to search

char : Required. Specifies the searched string.

Note : This function is binary-safe.

Example:

<?php
echo strrchr("Good Morning world!","Morning");
echo "<br /><strong> Example using ASCII code for search : </strong><br />";
echo strrchr("Good Morning",111);
?>
Output will be:
Morning world!
Example using ASCII code for search :
orning

strpos in PHP

 PHP Strpos() function is utilized to returns the  position of the beginning of the first instance of the string if found and false value otherwise.

Syntax:

strpos(string,find,start)
string : Required. Specifies the string to search

find : Required.Specifies the string being searched for.

start : Optional. Specifies the position at which the search should begin.

Note : This function is case-sensitive.

Example:

<?php
echo stripos("Good Morning","or");
?>
Output will be:
6

strpbrk in PHP

PHP strpbrk() function is utilized to search a string for any set of characters.

PHP strpbrk() function returns the rest of the string from where it discovered the first event of a specified character, otherwise it returns FALSE.

Syntax:

strpbrk(string,charlist)
string : Required. Specifies the string to search

charlist : Required. Specifies the string being searched for.

Tip: This function is case-sensitive.

Example:

<?php
echo strpbrk("Good Morning","dr");
?>
Output will be:
d Morning

strncmp in PHP

PHP strncmp() function is utilized to compares two strings.
The function returns :

0 – if the two strings are exactly equivalent.
<0 – if smaller byte is found in the string1.
>0 –if smaller byte is found in the string2.
Syntax:

strncmp(string1,string2,length)
string1 : Required. Specifies the first string.

string2 : Required. Specifies the second string.

length : Required. Specify the number of characters to use in the comparison.

Tip : This function is binary safe and case-sensitive.

Example:

<?php
echo strncmp("Good Morning","Good night",5);
?>
Output will be:
0

strncasecmp in PHP

 PHP strncasecmp() function is  identical to strcmp() function ,except that lowercase and uppercase Versions of the same letter compare as equal.

The function returns :

0 –if the two strings are exactly equivalent
<0 – if smaller byte is found in the string1.
>0 – if smaller byte is found in the string2.
Syntax:

strncasecmp(string1,string2,length)
string1 : Required.Specifies the first string.

string2 : Required. Specifies the second string.

length : Required. Specify the number of characters to use in the comparison.

Tip: This function is binary safe and case-insensitive.

Example:

<?php
echo strncasecmp("good morning","Good Night",6);
?>
Output will be:
-1

strnatcmp in PHP

 PHP strnatcmp() function is utilized to analyze two strings using a "natural" algorithm.
The function returns :

0 – if the two strings are exactly equivalent.
<0 – if smaller byte is found in the string1.
>0 – if smaller byte is found in the string2.
Syntax:

strnatcmp(string1,string2)
string1 : Required. Specifies the first string

string2 : Required. Specifies the second string

Tip: This function is case-sensitive.

Example:

<?php
echo strnatcmp("4Good Morning","12Good Morning");
echo "<br />";
echo strnatcmp("12Good Morning","4Good Morning");
?>
Output will be:
-1
1

strnatcasecmp in PHP

 PHP strnatcasecmp() function is utilized to analyze two strings using a "natural" algorithm.
The function returns :

0 –if the two strings are exactly equivalent.
<0 –if smaller byte is found in the string1.
>0 –if smaller byte is found in the string2.
Syntax:

strnatcasecmp(string1,string2)
string1 : Required. Specifies the first string

string2 : Required. Specifies the second string

Tip: This function is case-insensitive.

Example:

<?php
echo strnatcasecmp("4Good Morning","12Good Morning");
echo "<br />";
echo strnatcasecmp("12Good Morning","4Good Morning");
?>
Output will be:
-1
1

strlen in PHP

PHP strlen() function is used to returns the length of a string i.e number of characters in a string.

Syntax:

strlen(string)
string : Required. Specifies the input string

Example:

<?php
echo strlen("Good Morning");
?>
Output will be:
12

stristr in PHP

PHP stristr() function is used  to searches its first string argument to see if its second string argument is contained in it. Returns the substring of the first string that starts with the first instance of the second argument, if any is found – otherwise it returns false.

Syntax:

stristr(string,search)
string : Required. Specifies the input string to search

search : Required. Specifies the string to search for.

Note : PHP stristr() function is binary-safe and case-insensitive. For case-sensitive search, use PHP strstr() function.

Example:

<?php
echo stristr("Good Morning world!","MORNING");
echo "<br /><strong> Example using ASCII code for search : </strong><br />";
echo stristr("Good Morning",111);
?>
Output will be:
Morning world!
Example using ASCII code for search :
ood Morning

stripos in PHP

PHP stripos() function is utilized to returns the position of the beginning of the first instance of the string if found and otherwise it returns FALSE.

Syntax:

stripos(string,find,start)
string : Required. Specifies the string to search

find : Required. Specifies the string being searched for.

start : Optional. Specifies the position at which the search should begin.

Note : PHP stripos function is case-insensitive.

Example:

<?php
echo stripos("Good Morning","oR");
?>
Output will be:
6

stripslashes in PHP

PHP stripslashes() function is utilized to remove backslashes from given data included by the addslashes() function.

Syntax:

stripslashes(string)
string : Required. Specifies the input string.

Tip :  This function could be utilized to clean up a string recovered from a database.

Example:

<?php
echo stripslashes("Who\'s Sam\ Bru\ce?");
?>
Output will be:
Who's Sam Bruce?

stripcslashes in PHP

PHP stripcslashes() function is utilized to remove backslashes from given data included by the addslashes() function.

Syntax:

stripcslashes(string)
string : Required. Specifies the input string.

Tip : This function could be utilized to clean up a string recovered from a database.

Note : PHP stripcslashes() skips special character sets like "\n" and "\r", preserving any line breaks, return carriages, etc.

Example:

<?php
echo stripcslashes("Good \Morning, m\y name\ is Sam\.");
?>
Output will be:
Good Morning, my name is Sam.

strip_tags in PHP

PHP strip_tags() function is utilized to strips out all HTML, PHP and XML tags from given string. It also strip out all HTML comments.

Syntax:

strip_tags(string,allow)
string : Required. Specifies the input string

allow : Optional. Specifies the tags which will not be evacuated

Note: This function is binary-safe.

Example:

<?php
echo strip_tags("Good <b>Morning</b>");
echo "<br /><strong>Example using allow parameter : </strong><br />";
echo strip_tags("Good <b><i>Morning</i></b>","<b>");
?>
Output will be:
Good Morning
Example using allow parameter : 
Good Morning 

strcspn in PHP

PHP strcspn() function is utilized to get the amount of characters that happen between the begin of the main string and the first event of any character listed in the second string.

Syntax:

strcspn(string,char,start,length)
string : Required. Defines input string.

char : Required. Defines the characters .

start : Optional. Defines where in string to start

length : Optional. Defines the length of the string (how much of the string to search)

Note: This function is binary safe.

Example:

<?php
echo strcspn("Good Morning","r");
?>
The output  will be:
7

strcoll in PHP

PHP strcoll() function is utilized to compare two strings.This function utilizes current locale for doing the comparison. If the current locale is C or POSIX, Strcoll function is equivalent to strcmp().

The function returns :

0 – if the two strings are exactly equivalent.
<0 – if smaller byte is found in the string1.
>0 –if smaller byte is found in the string2.
Syntax:

strcoll(string1,string2)
string1 : Required. Specifies the first string.

string2 : Required. Specifies the second string.

Note : The PHP strcoll() function is case-sensitive but not binary safe. 

Example:

<?php 
setlocale (LC_COLLATE, 'NL');
echo strcoll("Good Morning","Good MORNING");
echo "<br />"; 
setlocale (LC_COLLATE, 'en_US'); 
echo strcoll("Good Morning","Good MORNING");
 ?>
Output will be:
-1 
1

strncmp in PHP

PHP strncmp() function is utilized to compares two string.
The function returns :

0 – if the two strings are exactly equivalent.
<0 – if smaller byte is found in the string1.
>0 –if smaller byte is found in the string2.
Syntax:

strcmp(string1,string2)
string1 : Required. Specifies the first string

string2 : Required. Specifies the second string

Tip: The PHP strncmp() function is binary safe and case-sensitive.

Example:

<?php
echo strcmp("good morning","Good Morning");
?>
Output will be:
1

strchr in PHP

 PHP strchr() function is utilized to find the first occurrence of a string inside another string (main string).
If char cannot be found, this function returns FALSE. 
It is an identical  to strstr() function.

Syntax:

strchr(string,search)
string : Required. Specifies the input string to search

search : Required. Specifies the string to search for.

Note : PHP strchr() function is binary-safe and case-sensitive. For case-insensitive search, use stristr() function.

Example:

<?php
echo strchr("Good Morning world!","Morning");
echo "<br /><strong> Example using ASCII code for search : </strong><br />";
echo strchr("Good Morning",111);
?>
Output will be:
Morning world!
Example using ASCII code for search :
ood Morning

strcasecmp in PHP

 PHP strcasecmp() function is identical to strcmp() function, except that lowercase and uppercase Versions of the same letter compare as equal.
strcasecmp() function returns :

0 – if the two strings are exactly equivalent.
<0 – if smaller byte is found in the string1.
>0 – if smaller byte is found in the string2.
Syntax:

strcasecmp(string1,string2)
string1 : Required. Specifies the first string

string2 : Required. Specifies the second string

Tip : The PHP strcasecmp() function is binary safe and case-insensitive.

Example:

<?php
echo strcasecmp("good morning","Good Morning");
?>
Output will be:
0

str_word_count in PHP

PHP str_word_count() function is utilized to count the number of words in a string.

Syntax:

str_word_count(string,return,char)
string : Required. Defines the input string.

return : Optional. Defines the return value of the PHP str_word_count()

char : Optional. Defines special characters to be considered as words

Example:)

<?php
echo str_word_count("Good Morning.");
echo "<br /><stromg> Example with an return parameter : </stromg><br />";
print_r(str_word_count("Good Morning Sam & John.",1));
echo "<br /><stromg> Example with an char parameter : </stromg><br />";
print_r(str_word_count("Good Morning Sam & John.",1,"&"));
?>
Output  will be:
2
Example with an return parameter :
 Array ( 
        [0] => Good 
        [1] => Morning 
        [2] => Sam 
        [3] => John 
        )
Example with an char parameter :
 Array (
         [0] => Good 
         [1] => Morning 
         [2] => Sam 
         [3] => & 
         [4] => John 
       )