Page 255 - Computer Software Application TP - Volume 1
P. 255

COMPUTER SOFTWARE APPLICATION - CITS




           TASK 6: Returning value from function

              1  Open the text editor
              2  Write the following codes
                              <html>
                              <head> <title>PHP </title></head>
                              <body>
                                  <?php
                                      function sum(int $x, int $y)
                                      {
                                            $z = $x + $y;
                                            return $z;
                                                }
                                              $a=10;
                                              $b=7;
                                      echo “sum of  $a and $b is”.sum(10,7);

                                   ?>
                            </body>
                            </html>
              3  Save the program in C:\Apache24\htdocs in a folder with .php extension
              4  Run the Apache services from windows services

              5  Open the browser and type the following address
                 http://localhost/foldername/
              6  Click the php file to run  and verify the output















           TASK 7: Create dynamic functions

              1  Open the text editor
              2  Write the following codes
                           <html>
                           <head>
                           <title>Dynamic Function Calls</title>
                           </head>
                           <body>
                             <?php
                                 function sayHello()
                                {




                                                           240

                               CITS : IT & ITES - Computer Software Application - Exercise 52
   250   251   252   253   254   255   256   257   258   259   260