Switch to full style
:read: Start PHP with us. Includes topics to help you in php
Post a reply

PHP Strings

Sat Sep 06, 2008 12:16 am

You can create a string by storing its value in a variable .or send it to echo command directly.The return of function may be stored in a variable.

Code:

<?
   $mystring
=" I am here";
   echo " I am here";
   echo "$mystring";
?>


the output is :
Code:

I am here I am here


Using single quotes :
you can create string using single quotes instead of double quotes.

Code:

<?
   $mystring
=' I am here';
   echo ' I am here';
   echo $mystring;
?>


the output is :
Code:

I am here I am here


to use single quote within string you have to escape it using backslash
for example
Code:
 echo 'I am \'Tom\' '; 


the output is :
Code:
I am Tom




Post a reply
  Related Posts  to : PHP Strings
 Sort strings java-Sorting Array of Strings     -  
 C++ Strings     -  
 compare two strings     -  
 Use Switch with strings     -  
 compare strings     -  
 Trimming Strings in php     -  
 Compare two strings in php     -  
 Help with selection sort for strings?     -  
 compare strings with if statement in php     -  
 Iterate on array of strings     -  

Topic Tags

PHP Strings