32,000+ SUBSCRIBERS CAN'T GO WRONG !!!

phpans
GET TOP ARTICLES, SNIPPETS, SCRIPTS IN YOUR INBOX FOR FREE!

Delivered by GET EMAIL UPDATES FeedBurner
We always respect your privacy and take protecting it seriously.
We won't Spam You

PHP String

, 0,
PHP String
We knew about PHP string in out past articles. But here we are going to discuss details about PHP String. PHP string is most important on PHP Career. Let's know how we create and use PHP String. At first we need to create it to use, then we can use that in function or script. It can store a value. In the example bellow sees that we use a string in a variable and we declare by echo.
<?php
$the_string = "Life is beautiful.";
echo "Life is beautiful.";
echo $the_string;
?>

Output Life is beautiful.Life is beautiful.
In this example, we insert a string into $the_string variable and we execute another string using echo without store any variable. We should focus that we will store a string into a variable when we use this variable in many places in a script. ok save the above code and run this, then this will execute like this.
PHP String
we used PHP String by Double quotes but we can also create a string using Single quotes, we know single quotes as apostrophes. Let's see the example
<?php
$the_string = 'Life is beautiful.';
echo 'Life is beautiful.';
echo $the_string;
?>

If we use 'Single quote' in Single quotes string then we need to use that like it,
<?php
echo 'PHPAns is pretty, isn\\\\'t it?';
?>

We used a backslash in this string. Double quote string is more helpful from the single quote.

Download PDF
Signup & Get $25 Free
Is this article helpful for you?





captcha

  • Connect
  •       
Top
Create an free account and start learning & sharing! Sign Up