Home Php php Strings



php Strings
Posted on: December 17, 2009 at 12:00 AM
String is the collection of characters which is stored in a single variable.

php Strings

     

String is the collection of characters which is stored in a single variable. PHP provides many in-built functions to use strings.

We need to enclose the string within double quote or single quote. We can store any string value into a variable or we can print the value directly instead, depends upon the need.

We can use both single and double quote for string creation. Now php introduces more robust technique called heredoc method to create string of multiple line.

Example:

<?php

echo 'This is the first string within single quote<br/>';

echo "This is the second string within double quote<br/>";

$string="Value from string variable";

echo $string;

$string=<<<END

This is a multiple line string

using heredoc method.

END;

echo "<br/>";

echo $string;

?>

Output:

This is the first string within single quote
This is the second string within double quote
Put some value to string variable
This is a multiple line string using heredoc method.

Related Tags for php Strings:


More Tutorials from this section

Ask Questions?    Discuss: php Strings  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.