Page 170 - TrackpadV2.1_Class8
P. 170

else                elseif              empty               enddeclare          endfor
                   endforeach          endif               endswitch           endwhile            extends

                   final               finally             fn                  for                 foreach
                   function            global              goto                if                  implements

                   include             instanceof          insteadof           interface           isset
                   list                namespace           new                 or                  print
                   private             protected           public              require             return

                   static              switch              throw               try                 use

                   var                 while               xor                 yield


                  VARIABLES IN PHP

                  A variable is a memory location that is used to store a value. When a variable is created, some
                  space is allocated in memory for it. This memory space is referred by the name that we give to an

                  identifier. A variable name must start with a $ (dollar) sign. For example,

                  <?php

                  $age = 12;
                  $name = "Divya";

                  $address = "12A, Stree No-4, Govindpuri";

                  $section = 'C';
                  ?>

                  Here 12, "Divya", "12A, Stree No-4, Govindpuri" and 'C' are the values assigned to variables
                  named age, name, address and section respectively. The = (equal) operator is used to assign
                  a value to a variable. Let us create a web page to show the use of variables. Type the following
                  code in notepad:


                  <HTML>
                  <HEAD> <TITLE> Using Variables </TITLE> </HEAD>

                  <BODY>

                  <?php
                  $name = "Divya";

                  echo "Welcome ", $name;

                  ?>
                  </BODY>

                  </HTML>




                  168   Trackpad (V2.1)-VII
   165   166   167   168   169   170   171   172   173   174   175