Basic HTML Version

|  | Table of Contents |  | View Full Version

Page 167 - 2633 Trackpad Pro V5.1 Class 7
P. 167

    Writing First PHP Script

                     The echo statement is used in a PHP script to display the output on the web page. It can be used
                     with or without parenthesis. Let us write a PHP script to display Hello World! message. Perform
                     the following steps to create the script:
                     Step  1   Open Notepad and type the following code:

                     <HTML>
                     <HEAD> <TITLE> First PHP Script </TITLE> </HEAD>
                     <BODY>
                     <?php
                     echo "Hello World!";
                     ?>
                     </BODY>
                     </HTML>

                     Step  2   Save the file with the Hello.php name under the C:\xampp\htdocs folder.

                     Running a Script

                     Perform the following steps to run a script:

                                                                  2  Type the following URL in the
                                1  Open a Web browser..          Address bar: http://localhost/hello.php

                     The echo statement will display Hello World! on the web page. Note that every PHP statement
                     should be terminated with a semicolon. Ensure that the Apache HTTP Server should be running
                     before executing the script.

                     PHP KEYWORDS

                     PHP provides a set of keywords that are reserved words. They cannot be used as variable names,

                     class names or method names. Some of the keywords are as follows:
                      Abstract            And                 As                  Break               callable

                      Case                catch               class               clone               const
                      continue            declare             default             do                  echo

                      else                elseif              empty               enddeclare          endfor
                      endforeach          endif               endswitch           endwhile            extends

                      final               finally             fn                  for                 foreach

                                                                                                     Techipedia (PHP)  165

| 162 163 164 165 166 167 168 169 170 171 172 |