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

COMPUTER SOFTWARE APPLICATION - CITS





                                ?>
                 </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












           IV  Using preg_split() for splits a string into substrings

              1  Open the text editor
              2  Write the following codes
                          <html >
                 <head>
                     <title> Using preg_split()</title>
                 </head>
                 <body>
                        <?php
                   // String to split
                   $string = “Hello, World! This is a test string.”;
                   // Split the string by spaces or punctuation marks
                   $words = preg_split(“/[\s,]+/”, $string);
                   // Display the resulting array
                   print_r($words);
                               ?>
                 </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














                                                           308

                               CITS : IT & ITES - Computer Software Application - Exercise 58
   318   319   320   321   322   323   324   325   326   327   328