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

COMPUTER SOFTWARE APPLICATION - CITS




                                       echo “Hello<br />”;
                               }
                               $function_holder = “sayHello”;
                               $function_holder();
                           ?>
                         </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 8: Accessing variable with the global statement
              1  Open the text editor
              2  Write the following codes

                             <html>
                             <body>
                             <?php
                                $count = 1;
                                function keep_track()
                               {
                                          global $count;
                                     $count=5;
                                         echo”inside the function  “. $count;
                                     echo “<br />”;
                                }
                                keep_track();
                                echo “outside the function  “.$count.”<br />”;
                             ?>
                             </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



                                                           241

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