Info2180 Tutorial 5

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

Tutorial 5

In this tutorial we will discuss the basics of PHP. Take a look at the code
in the link below to see a basic examples of:

• A simple form being processed by PHP.


• Using PHP Super Globals
• Include les
• String concatenation
• PHP echo shortcut syntax
• Printing dates

https://github.com/uwi-info2180/info2180-php-forms

Download (or clone the above repository with Git) to your own computer.
Assuming you have PHP installed you can use the PHP development
server by navigating to the folder with the code at the command line/
prompt and running php -S localhost:8000 and then browse to
http: localhost:8000 in your web browser.

You can also install WAMP, MAMP or XAMPP on your own computer.

• WAMP - http://www.wampserver.com/en/
• MAMP - https://www.mamp.info/en/
• XAMPP - https://www.apachefriends.org/index.html
/
fi
/
Discussion Questions

1. What is the difference client-side and server-side code?


2. What are some examples of client-side and server-side languages/
libraries/frameworks that you know of?
3. How do you denote a block of PHP code?
4. How are variables de ned in PHP?
5. How are strings concatenated in PHP?
6. What is string interpolation? Does it work with single or double
quotes?
7. What are some common string manipulation functions that you have
heard of?
8. There are two ways of outputting/printing data to the screen in PHP.
What are they and what is the difference between them?
9. There is shortcut syntax that can be used in PHP to print data. How is
that short tag written?
10.How is a function de ned? Are PHP functions case-sensitive or case-
insensitive?
11.What are Super Globals and can you give examples of some?
12.If you have some common bits of PHP code (or even HTML) that you
may want to reuse on multiple php pages, what could you use to load
this into another php page?
13.What are some things you can do to help you to debug your PHP code?
14.If you wanted to print or format the date in PHP, what function or Class
could you use?
fi
fi

You might also like