• BOOKMARK

  • ADD TO FAVORITES

  • REFERENCES


  • MARC

    Mailing list ARChives
    - Search by -
     Subjects
     Authors
     Bodies





    FOLDOC

    Computing Dictionary




  • Text Link Ads






Variable Concatenation

PHP Tutorials.

Variable Concatenation

New postby Ranman on Thu Mar 27, 2008 10:36 pm

Code: [Select all] [Expand/Collapse] [Download] (Untitled)
   "Concatenation" means joining two into one


Q. What is the diffrence between " and '?
A. By example:

   This will print "This is 5 and text."

<?
$var = 5;
$text = "This is $var and text.";
echo $text;
?>


   This will print "This is $var and text."

<?
$var = 5;
$text = 'This is $var and text.';
echo $text;
?>


Example 1:

   The following prints "Some text then 15.2"

<?
$a = 15.2;
echo $b = "Some text then $a";
?>


Example 2:

   The following prints "10.5"

<?
$a = 4.3;
$b = 6.2;
$a += $b;
echo $a;
?>


Example 3:
    The following prints "10.5"

<?
$a = 4.3;
$b = 6.2;
$c = $a += $b;
echo $c;
?>


Example 4:

    The following prints "11"

<?
$a = 4.3;
$b = 6.2;
$c = 0.5;
$c += $a += $b;
echo $c;
?>


Example 5:

    The following prints "10"

<?
$a = 4.3;
$b = 6.2;
$c = -0.5;
$c += $a += $b;
echo $c;
?>


User avatar
Ranman
Site Admin
 
Posts: 25
Joined: Thu Mar 27, 2008 12:27 am

Re: Variable Concatenation

New postby Joplin on Mon Dec 23, 2013 12:24 pm

PHP Offical Documentation
String Operators
User avatar
Joplin
 
Posts: 12
Joined: Tue Apr 01, 2008 12:34 am


Return to PHP Tutorials

Who is online

Users browsing this forum: No registered users and 0 guests

  • MORE RESOURCE


  • Linux

    The Distributions





    Linux

    The Software





    Linux

    The News



  • MARKETING






  • Toll Free
cron