variables in php

If you have learned C,C++ you know about variables.Also in PHP ,variables are used.Variables in php used to store information and also to get back information when we need.

php variables

Points to Remember while using PHP Variables

  • Add $ before  variable name like this $variable
  • Variables are case-sensitive.Example:There is difference between $variable & $Variable
  • Variable should not start with numbers like $123.
  • Variable should not start with * like $* variable.

Use wamp server to learn php If you have not yet used see  the below link,

Learn php in wamp server

  • Open notepad copy and paste the below code in notepad

<html>
<head>
    <title>PHP sript</title>
</head>
<body>
<?php
$variable='name';
$Variable='name2';
echo"$variable";
echo"<br>";
echo"$Variable";?>
</body>
</html>

  • You get output like,

image

  • Save in php format.Goto wamp folder>>www and place the php file.Open wamp server
  • We have used <br>  to display name2 in next line.
  • If you want to connect two variables add .$variablename like below

    <?php echo"$variable".$Variable;?>

  • You get output like,

image

There are more things in php variables we will share in further posts.

Print Friendly and PDF
SHARE

About me

Hi. I am interested in blogging.And sometimes play with webdesign,web development,domain sale,designing logo and more.

    Blogger Comment
    Facebook Comment

0 comments :

Post a Comment

Pages