In this Introduction to PHP guide, we look at How is PHP Executed, and more on Writing a PHP Script File, based on Codecademy's Learn PHP General Purpose Programming. We learned in previous lessons that PHP is sent from the back-end to the front-end, there it is received as HTML and displayed in our browser. We are taught in this lesson that PHP is flexible and may be executed from the terminal as well. We learn that we are able to use general-purpose programming languages to write programs that will give simple instructions to our computer without having to involve the web or HTML! This can be very useful when we want to test functionality or when writing simple local programs, or when writing simple local scripts. We are told that when writing PHP script files, we always need to denote the beginning of our PHP code with our opening PHP code but the closing tag is no longer required! We are also taught that PHP generally will ignore whitespace. We are shown examples that look like they should provide different results because of the whitespaces, but logs the same PHP to the terminal. We also learn that, unlike other languages, PHP is not always case-sensitive. For example, we are able to use the "echo" keyword with a capital e ("Echo") and it will still work. But we should avoid doing this and use standard casing.
Тэги:
#Code #Coding #PHP #Programming #Server-side #Tutorials #back-end