Monday, March 2, 2020

PHP Hello, World! Basic Print Script

PHP Hello, World! Basic Print Script Every programming language has it- the basic Hello, World! script.  PHP is no exception. It is a simple script that only  displays the words Hello, World!  The phrase has become a  tradition for new programmers who are writing their first program. Its first known usage was in B.W. Kernighans 1972 A Tutorial Introduction to the Language B, and it was popularized in his The C Programming Language.  From this beginning, it grew into a tradition in the programming world. So, how do you write this most basic of computer programs in PHP? The two simplest ways are using  print and  echo, two similar statements  that are more or less the same. Both are used to output data to the screen. Echo is slightly faster than print. Print has a return value of 1, so it can be used in expressions, while echo has no return value. Both statements can contain HTML markup. Echo can take multiple parameters; print takes one argument. For the purposes of this example, they are equal. ?php Print Hello, World!;php Echo Hello, World!;? In each of these two examples, the ?php indicates the start of a PHP tag and the ? indicates an exit from PHP. These entrance and exit tags identify the code as PHP, and they are used on all PHP coding.   PHP is  server-side software that is used to enhance the features of a web page. It works seamlessly with HTML to add features to a website that HTML alone cant deliver, such as surveys, login screens, forums, and shopping carts. However, it leans on HTML for their appearance on the page. PHP is open-source software, free on the web, easy to learn, and powerful. Whether you already have a website and are familiar with HTML or you are just entering web design and development, it is time to learn more about beginning PHP programming.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.