Saturday, April 3, 2010

String Variables


String Variables in PHP


A string can be used directly or it can be stored in a variable. For instances:


(click image to view)

############################################################
The Output: Good Morning Everyone!
############################################################


The Concatenation Operator

The concatenation operator is used to put 2 or more string values together.


(click image to view)

############################################################
The Output:

Good Morning Everyone!
Have a nice day!
############################################################


The strlen() function

Lets try to find the length of a string:


(click image to view)

############################################################
The Output: 22
############################################################


The strpos() function

The strpos() function used to search a character within the string. If a match is found, this function will return the position of the first match. If no match is found, it will return FALSE. For instances:


(click image to view)

############################################################
The Output: 5
############################################################

No comments:

Post a Comment