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

COMPUTER SOFTWARE APPLICATION - CITS




                              <title>Passing Argument by Reference</title>
                              </head>
                              <body>

                                       <?php
                                            function addFive($num)
                                            {
                                                 $num += 5;
                                            }
                                            function addSix(&$num)
                                            {
                                                $num += 6;
                                            }
                                            $orignum = 10;
                                            addFive( $orignum );
                                            echo “Original Value is $orignum<br />”;
                                            addSix( $orignum );
                                            echo “Original Value is $orignum<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






































                                                           238

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