Total members 11889 |It is currently Thu Mar 28, 2024 11:07 am Login / Join Codemiles

Java

C/C++

PHP

C#

HTML

CSS

ASP

Javascript

JQuery

AJAX

XSD

Python

Matlab

R Scripts

Weka





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




_________________
M. S. Rakha, Ph.D.
Queen's University
Canada


Author:
Mastermind
User avatar Posts: 2715
Have thanks: 74 time
Post new topic Reply to topic  [ 1 post ] 

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



Topic Tags

PHP Strings
cron





Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com