- 1. PHP Basics for Designers
-
- Atlanta Web Designers Group
2. So what is PHP?
-
- Mainly intended for web applications.
-
- Also useful for other things.
-
- That last part is another story for another time...
3. Let's jump right in...
4. How is that useful?
-
- When 'Hello world!' could be anything.
-
- Result :
Goodbye cruel world!
5. Can you break that down?
opening PHP tag variable assignment operator string (quote to
quote) closing PHP tag end of statement 6. A little shorter,
maybe?
-
- For #2, short_open_tag must be on.
7. Now you see me...
-
- The HTML here is displayed.
8. ... and now you don't.
-
- The HTML here isnotdisplayed.
Here's why 9. On one condition...
comparison operator == for is != for is not 10. Playing with
strings
-
- These all result in the same output.
-
- echo 'Hello'.' '.'world!';
-
- echo $greeting.' '.'world!';
-
- echo $greeting.' '.$object.'!';
concatenation operator (combines strings) 11. Building
strings
-
- $greeting= $greeting .' world!';
12. All for one...
13. ... one for all.
-
- The same list of items in PHP.
14. Adding a dimension...
row column key value 15. ... and displaying it.
16. The results are in!
17. The not-so-great wall
-
- http://example.com/foo.php?title=
-
- Most likely, this is not good for security.
18. The great escape
-
- http://example.com/foo.php?title=
19. Stylish yet functional
-
- Functions are reusable bits of code.
-
- foreach ($items as $item) {
-
- $result .= '
- ' . htmlspecialchars($item) . '';
20. Call me
21. Plug and play Content 22. Want to learn more?
-
- irc://irc.freenode.net/phpc
-
- irc://irc.freenode.net/phpwomen
-
- http://phpbuilder.com/board
-
- http://www.amazon.com/dp/0596005601
23. To sum it up...
-
- Avoid copy and paste. Includes and functions!
-
- Before outputting variables, escape them!
-
- PHP has lots of built-in functions. Use them!
-
- Don't let your learning about PHP stop here!
24. Questions?