473,395 Members | 1,537 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Your opinion appreciated: a good php foundation course.

290 100+
Hi,

I am looking at putting together a good quality foundation course for php that
be be really helpful for beginners that want to get into web development.

Many of us started learning php from a book and then just dabbling in it and creating our own sites. Others have had a more structured academic start.

May I ask :
1) how did you begin learning php?
2) what do you wish you had done differently.
3) what do you think an 8 week php foundation course
should really contain as its core lessons?

Personally, I would have learned a lot quicker and been a lot more productive
over the past two years if I had followed a good course in the beginning !

What do you think? Your thoughts and insights would be appreciated.
Dec 6 '09 #1
15 1754
Dormilich
8,658 Expert Mod 8TB
I would make sure they know about the PHP Manual (and know how to use it). quite a lot of problems can be avoided, if you read what’s in there (e.g what (type of) parameters does this function expect, what are the return values, what happens in case of an error). additionally, the comments section is a treasure box.

further they shold be introduced to code structuring (indentation, code readability) and (very important) code documentation.

and of course: Exceptions and error handling
Dec 6 '09 #2
jeddiki
290 100+
That's a great post, thanks.

Anyone else got some thoughts on this ?
Dec 6 '09 #3
Dormilich
8,658 Expert Mod 8TB
Anyone else got some thoughts on this ?
how deep do you want to dive into PHP?

it can be especially useful to cover basic OOP, because most of the advanced packages (database access (MySQLi, PDO), XML processing (SimpleXML, DOMDocument), Memcache, Exception, etc.) are made for that.

and I recommend User Input Validation (e.g. filter functions), database security (SQL injection), type validation (typeof, instanceof, is_array(), etc.)
Dec 6 '09 #4
jeddiki
290 100+
Good you mentioned that,

I was thinking of doing an intro into OOP
and to give a couple of simple examples as one of the last
sections.

The main elements would be taught as procedural php
rather than OOP.

Of course to teach about SimpleXML and DOMDocument
would require an understanding of OOP as would
the use of any classes like ZipArchive, or the mailer class: swift.

I am thinking that these would need to go into a more advanced
course.

Since it is fundamentals, I am starting from ground zero

The idea is to provide an 8 week course where participants are likely to be working full time and can only give 10 - 15 hours a week

I have incorparated what you suggested into this of
what I think are the fundamentals.

I am assuming that the participants will have a reasonable knowledge of
HTML and CSS.

This is what I have so far.

BTW: The headings that just say "introduction" mean I will only
give an overview or breif explaination but no worked examples.
the subject will need to be more fully covered in a deeper course.

What do you think? What should be added of takenout ?

( I am not sure about PEAR - maybe just an intro)
There is also GD and image construction ??

Start:
Basically how PHP Works
What the config file is (not in detail).php.ini
Exceptions and error handling (set it to show errors)

PHP Syntax, PHP Tags
PHP Statements and Whitespace
Comments
PHP Functions - the MANUAL
Variables: Types, Names (Identifiers
Variable Scope, Superglobals, Constants
Some variable testing and manipulation functions
Single Quotes vs. Double Quotes
Passing Variables on the URL
Passing Variables via the Query String

Writing a script.
code structuring with indentation, comments

# String Manipulation
Formatting Strings
Concatenation
String Manipulation Functions

# Flow Control
If Conditions and if/else
Loops while, do...while, for, break and continue

# Arrays
Enumerated Arrays
Initializing Arrays, Appending to an Array
Reading from Arrays. Looping through Arrays
Initializing Associative Arrays Reading from Associative Arrays
Looping through Associative Arrays
Superglobal Arrays

Two-dimensional Arrays
Reading from Two-dimensional Arrays
Looping through Two-dimensional Arrays
Array Manipulation Functions

# PHP and HTML Forms
How HTML Forms Work
Form Variables and Processing Form Input
Form Validation and Presentation Functions

# Code Includes
Including Files: require and require_once
auto_prepend_file and auto_append_file

# User Functions
Defining and Calling Functions
Default Values ,Variable Scope
By Reference vs. By Value

# Managing Data
Connecting to mySQL
Creating a Table with php
Inserting, Updating, Appending Data
Querying a Database

# PEAR:DB
Advantages and Disadvantages of PEAR DB
Why use a database abstraction layer?
When not to use a database abstraction layer?
Using PEAR DB

# Authentication with PHP and SQL
A Database-less Login Form
Authenticating Users
SQL injection protection
type validation

# Regular Expressions
Perl-compatible Regular Expression Functions
preg_match()
preg_replace()
Regular Expression Tester
Regular Expression Syntax
Start and End ( ^ $ )
Number of Occurrences ( ? + * {} )
Common Characters ( . \d \D \w \W \s \S )
Grouping ( [] )
Negation ( ^ )
Subpatterns ( () )
Alternatives ( | )
Escape Character ( \ )
Form Validation Functions with Regular Expressions

# Session Control and Cookies
Introduction to Sessions
Introduction to Cookies

# Sending Email with PHP
mail() - Shortcomings of mail()
class.SwiftMailer

# OOP
Introduction

# File System Management
Introduction
Dec 6 '09 #5
Dormilich
8,658 Expert Mod 8TB
# Managing Data
Connecting to mySQL
Creating a Table with php
Inserting, Updating, Appending Data
Querying a Database
most of these topics are not directly related to PHP, since most of it is pure SQL.
but for the connection, you can of course tell the old procedural way, but since you want to introduce database abstraction layers anyway, go straight for MySQLi and/or PDO. (if you don’t talk about the old, error prone functions, the participants are not that exposed to the standard database newbie errors, though it will be a bit though to get into).

# PEAR:DB
no need to discuss it if you speak of database abstraction layers (in common) later. last time I used MDB2 (the successor of DB) I was plagued by compatibility warnings (it was coded for PHP 4). you should also check, whether it is actually better than the two built-in packages (MySQLi, PDO). and of course any DBAL requires some OOP knowledge.

# OOP
put it together with database handling, you won’t run out of sensible examples there. (e.g. apply a Singleton Pattern)

Exceptions and error handling (set it to show errors)
not just how to show/hide errors. make errors/exceptions a tool. good error handling is half the debugging (many people underestimate the error messages, in contrast to some other languages, PHP is quite self explanatory), thus make it not too short, especially Exception handling can save your life in a complex script (keyword: "backtrace")
Dec 6 '09 #6
jeddiki
290 100+
Thanks for your input again.

The main thrust of what I would like to teach is how to build
useful scripts from the start.

For this to happen, I might even move the MySQL right up near the
front so that newbies can get to see the power of dynamic web pages very quickly. After doing that - then I could back track and fill in details about strings, variables, arrays, loops etc.

Yes this section will contain quite a bit of SQL but not without php.
For instance: Creating a table can be done with phpmyadmin or other tools
but I always prefer doing it with a script, that way I always have a pattern
to start off with - just makes it much quicker and my tables all have a familiar look to them.

I don't think I can expect anyone who doesn't know php to already know SQL, so I think I will have to include that.

It is similar with regular expressions which are also used in c+, pearl etc - but I still have to put them into the php course don't I ? I can not expect people to know about how to use them.

The main thrust is not to theorize, but to get them using code in useful ways. The easiest thing to grasp for most people seems to be standard MySQL.

no need to discuss it if you speak of database abstraction layers (in common) later. last time I used MDB2 (the successor of DB) I was plagued by compatibility warnings (it was coded for PHP 4). you should also check, whether it is actually better than the two built-in packages (MySQLi, PDO). and of course any DBAL requires some OOP knowledge
.

Yes - I think this could get messy, maybe I should just give an explanation of PEAR in genearal and then highlight some of the most useful elements.
( which do you suggest)

Then I should focus on one area - such as MySQLi. Good thing about this is that it can be written procedurally - so I can do a few examples, that will fit in with what has already been explained. That would be the place to explain Prepared statements.

Then later, after introducing OOP and showing a few classes, I can also show how to use MySQLi.in OO.

So: - towards the end
# OOP
Introduction
ZipArchive class
SimpleXML and DOMDocument

Using MySQLi.in OO.
The way ahead.
Dec 7 '09 #7
Dormilich
8,658 Expert Mod 8TB
The main thrust of what I would like to teach is how to build useful scripts from the start.
hm, this is a kind of theory to itself, valid for every programming language.

After doing that - then I could back track and fill in details about strings, variables, arrays, loops etc.
IMO not the best way, if you don’t know the basics (e.g. the difference between double and single quoted strings) you’re about to run into parser errors or unexpected (to the newbie) output results.

but I always prefer doing it with a script, that way I always have a pattern to start off with - just makes it much quicker and my tables all have a familiar look to them.
the script is only a tool. and I really can’t imagine how PHP would influence the "look" (whatever this may be)—my personal opinion.

The main thrust is not to theorize, but to get them using code in useful ways.
you can’t program what you don’t understand. as soon as the script goes beyond copy/paste you need this "theory" very badly.

maybe I should just give an explanation of PEAR in genearal and then highlight some of the most useful elements.
explanation of PEAR and PECL in general—yes,
most useful elements—as you desire

such as MySQLi. Good thing about this is that it can be written procedurally - so I can do a few examples, that will fit in with what has already been explained.
good idea. you can nicely jump from here to OOP.

may I point out, that PDO has better fetching options than MySQLi?
Dec 7 '09 #8
jeddiki
290 100+
may I point out, that PDO has better fetching options than MySQLi?
As I had not used the PDO extension up until now, I dived into some tutorials.
It seems really useful for programming for multiple database types, but as I intend to stick to explaining how to get the best out of Mysql, I don't think there will be any need to go into detail about it.

Probably it is enough to explain what it is and that it is there for anyone who needs to access other db systems.

I quote from one tutorial on Devshed "the PDO extension would be rather pointless if you’re going to work with only one database server."

Don't know if you agree ?

MySQLi on the other hand will prove very useful for most people.
Dec 9 '09 #9
Dormilich
8,658 Expert Mod 8TB
It seems really useful for programming for multiple database types
that's only a secondary feature (for me). the really usefull stuff are the methods, that allow you to fetch all results at once, so you don’t need to loop over the result set. and the use of exceptions.
Dec 9 '09 #10
Markus
6,050 Expert 4TB
No way would I attempt to teach OOP on a beginners course. It'd be a system-overload and very intimidating. After all, OOP is not the be all and end all of programming - something I have come to see the general PHP community believes (that is, they think "if you're not practising OOP, you're doing it wrong."). That eliminates PDO and MySQLi (although MySQLi has it's procedural counterparts).

What's great about PHP is that you can do things fast. You get immediate results and nothing is more exciting to a newbie than being able to learn something relatively easily and have something to show for it. So be sure to have your students doing something that gives them results.

Of course you'll start off with a "What is PHP?" Be sure to mention that it is an open-source project with literally 100s of developers working on it's internals. Then show them some statistics - how many workplaces require PHP developers, the average salary (local to your area - not somewhere like India), how many websites / servers are using PHP, etc. Keep them interested.

Next give them the "Hello, World!" example and run-through the syntax: opening PHP tag (what does it do?), the 'echo' function (is it a function or is it a language construct? What is a language construct? Show them some other examples of language constructs - print, for, select, etc.)

At this point you'll want to impart on them some knowledge about how programming works, or more specifically, how the brain of a programmer works. How you approach a task: specify the different results needed by the application, think about how you would accomplish those tasks if they were real-world problems (say it out-loud and then put it into a program), algorithms, etc. This is necessary because simply showing someone the syntax of a language does not show them what to do with it. Get them thinking in terms of conditionals, variables, security, etc., all of which you will show them later.

<writer's block>

I'll be back with some more suggestions later :D
Dec 9 '09 #11
Dormilich
8,658 Expert Mod 8TB
No way would I attempt to teach OOP on a beginners course. It'd be a system-overload and very intimidating.
hm, yea. that means that the "advanced security" section is to be held later.
Dec 9 '09 #12
Markus
6,050 Expert 4TB
@Dormilich
Yeah. However, the students should be told to remember this: treat all input as dangerous. Also, they should be shown the filter extension.
Dec 9 '09 #13
Dormilich
8,658 Expert Mod 8TB
what do you think, should be told that there is something like OOP and advanced security mechanisms, but it can’t be covered in this course?
Dec 9 '09 #14
jeddiki
290 100+
Thanks Markus for that long post - very helpful.
What's great about PHP is that you can do things fast. You get immediate results and nothing is more exciting to a newbie than being able to learn something relatively easily and have something to show for it. So be sure to have your students doing something that gives them results.
That was pretty much what I was getting at when I wrote:

The main thrust of what I would like to teach is how to build
useful scripts from the start.

For this to happen, I might even move the MySQL right up near the
front so that newbies can get to see the power of dynamic web pages very quickly. After doing that - then I could back track and fill in details about strings, variables, arrays, loops etc.
I definitely want to mention OOP and some examples but in a fundementals course, I also think it would be overload to do too much.

This thread has given me a lot to think about so thanks again to D and M
:)

Does anyone else have some ideas for me ?
126 peopl have read the post so there must be some thoughts on this ;-)
Dec 9 '09 #15
Dormilich
8,658 Expert Mod 8TB
so thanks again to D and M
thank god my name is not Steven… (¬_¬)
Dec 9 '09 #16

Sign in to post your reply or Sign up for a free account.

Similar topics

12
by: windandwaves | last post by:
Hi Folks I have just completed a project for an accommodation finder in New Zealand - much with your help - thank you again. I would appreciate any constructive or deconstructive comments. ...
5
by: Ron Stephens | last post by:
The newly rechristened Python Learning Foundation is a web site dedicated to the assistance of people learning the Python programming language. Features include: 1. Daily lists of new and recent...
0
by: melledge | last post by:
Mozilla Foundation Co-Hosts Europe's Leading XML and Web Developer Conference XTech 2005 Conference to Bring Together XML and Web Technology Thought Leaders
11
by: Michael Kalina | last post by:
Hi everybody! I have three questions, maybe somebody could help me with it. 1. "If you have a minute or two..." I usually do not do a lot with CSS, but I decided to have my site run on pure...
32
by: William Stacey [MVP] | last post by:
Here is the link. If you find an issue or think of a feature, please post a reply or send an email. Cheers! http://www.mvptools.com/doco/csharp/semaphoredjikstra.htm -- William Stacey, MVP
192
by: Vortex Soft | last post by:
http://www.junglecreatures.com/ Try it and tell me what's happenning in the Microsoft Corporation. Notes: VB, C# are CLS compliant
12
by: anna | last post by:
Map, generate, and maintain 50% of your .NET application code, namely your business and data objects. Use these objects in ASP.NET, Windows Forms, console or services applications. Business and...
3
by: Visually Seen # | last post by:
Hey everybody, I want to create my own programming language, using C#. Could anyone give me some tips, advice on this goal? Let's say that in my programming language uses the keyword, integer...
11
by: www.douglassdavis.com | last post by:
I'm looking for advice here, and I would really appreciate it if you could help. Is there a VB 2005 book that you like and would recommend (and why)? Would you consider it good for...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.