Home Php php Strings
Questions:Ask|Latest

 
 

Share on Google+Share on Google+

php Strings

Advertisement
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.

Advertisement

If you enjoyed this post then why not add us on Google+? Add us to your Circles



Liked it!  Share this Tutorial


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: December 17, 2009

Related Tutorials

Ask Questions?    Discuss: php Strings  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments
DMCA.com