PHP String

String in PHP

String-PHP.jpg
PHP Sring

A series of characters widely used to store and manipulate the text is called the PHP String. PHP supports only 256-character set and therefore does not offer support for native Unicode.

There are basically two methods to show the string in PHP:
  1. Single Quoted
  2. Double Quoted

Single Quoted

In PHP the programmer can create a string simply by enclosing the text in a single quote(' '). In general, this method is known as the easiest way to define the string in PHP. This type of Php string processes no special characters within quotes.

In order to specify a literal single-quote in PHP, you have to escape with a backslash (\) to describe a single quote literally and use a double backslash (\\) to set a literal backslash (\). Instead of having some special meaning, all other backslash instances, namely \r or \n, are generated the same as defined.

Here is an example which will allow you to understand in depth the single-quoted string in PHP:

<?php 
  
// single-quote strings  
  
$str  = 'Welcome to PHPTPOINT'; 
  echo $str; 
   
?>


Example2:

<?php  
// single-quote strings 


   $Str='We are here to offer web design and development tutorial';  

   echo $Str;  


?>  

Double Quoted

In PHP the programmer can create a string simply by enclosing the text in a double quote(" "), And the fact is that the escape sequences and variables, unlike in the single quote, can usually only be interpreted by using double-quote PHP strings.


Here is an example which will allow you to understand in depth the double-quoted string in PHP:

<?php 
  
// Double-quote strings  
  
$str  = "Welcome to PHPTPOINT"; 
  echo $str; 
   
?>


Example2:

<?php  
// Double-quote strings 


 $Str  = ''We are here to offer web design and development tutorial'';  

   echo $Str; 

?> 

Comments

Popular posts from this blog

Laravel Tutorial for Beginners

Ajax Tutorial

CodeIgniter Tutorial