Part 1: Introduction to PHP Programming


  1. How does Eli describe PHP?
  2. PHP allows you to dynamically write HTML, JavaScript, and CSS as the page is being delivered to the end user. It also allows you to interact with data sources, as it is the intermediary between text files and MySQL or other databases. It can write information to, or pull data from, databases, websites, and other files. It is used for web applications and the script itself runs on a web server.

  3. Briefly compare and contrast scripted and compiled languages.
  4. Scripted programming languages use what are essentially text files that are uploaded to a server with an interpreter, so that whenever that file or script is accessed, it is created on the fly by the interpreter to be delivered to the user. You are always using a text file, and are always able to view the source file, unlike in compiled languages. Compiled languages, such as C++, run code through a compiler in order to create an executable file that can be executed by the computer. It cannot be edited or reverse engineered as easily as the files utilized by scripted languages.

  5. Briefly explain the difference betwen client side and server side scripting.
  6. Client side scripting, used by languages such as JavaScript, sends the entire program to the destination computer, which allows anyone at the destination computer to read the entirety of the script that has been sent. Server side scripting, used by PHP, has the web server runs the entire script and only sends back the result. Therefore, the end users do not get the actual script which can contain sensitive information such as usernames and passwords.

  7. What popular website does Eli cite as an example of what you can do with PHP and MySQL? Why did Eli say that this particular site was a good example?
  8. Eli cites Craiglists as an excellent example of the power of PHP and MySQL. Despite not having an attractive interface, it is effective and powerful at doing what it needs to do.

  9. What does Eli emphasize as the 'nice' thing about scripted languages such as PHP?
  10. In PHP, you are always able to read the source text file. Additionally, all of the processing is done on the web server, and only when it has been processed fully are the results are sent to your computer. This is more secure than languages such as JavaScript, which run client side.

  11. What is notepad++? Why woudl Eli recommend notepad++?
  12. notepad++ is a text editor, like Notepad, with some extra functionality to make coding simpler. Notepad++ can be set up to connect directly to your file server, which makes it recommended over a more basic text editor.

  13. If you want to write and run PHP code, what do you need?
  14. PHP can be written in any basic text (ASCII) editor, such as Notepad, and a reference book such as Visual QuickStart Guides. Online references such as PHP.net can be utilized as well. You will also need a web server capable of supporting PHP, such as a web hosting platform like GoDaddy, to which you can upload your PHP files.

  15. How does Eli describe syntax?
  16. Eli describes syntax as "how you spell" the commands you are going to be using in coding, such as using double quotation marks over single quotation marks.

notepad++ Example Program

The link above is the sample code created with Eli's demonstration of introductory PHP programming. It utilizes the phpinfo() function to display information about the web server.