> > The tutorial is a bit small. Id really like to have something like
> > http://www.koehntopp.de/php/ in the manual (URL is in German!).
>
> This is an FAQ, not an intro. IMHO we have many info in the language
> reference section about the language, we just need to write up some
> small intro first, starting with tut.php. I think the intro part is
> not the right place to write things like the Zend Intro to PHP (link
> on tut.php), because we do not need duplicates of control structures,
> variables, types descriptions... IMHO it would be nice to have a small
> intro part (though bigger than the current what is php) first.
Here's an example format that deals with current topics in the manual yet
in a more wordy/newbie friendly way. Can't think of a good description of
control structures offhand, will use 'this and that' for now. This is not
a proposal, careful choice of wording is important, something I did not
fully do. That said:
---
Control structures do this and that, here is an example if statement:
$foo = 'bar';
if ($foo == 'bar') {
print "$foo is bar, cool!";
}
This says, "If variable $foo is equal to the string 'bar', then
execute the PHP commands within the { braces }." Another example:
$var = 'hello';
if (isset($var)) {
print "$var is set, this is good";
}
This says, "If the return of isset() is true, execute the PHP commands
within the { braces }." In reading about isset() in the manual, you'll
notice that it returns true if $var exists, otherwise isset() will return
false. Using isset() is one example, most PHP functions/constructs fit
this general model, the manual will explain for each. Let's say it is
false, then the PHP commands within the braces will not be executed in the
above examples, it's as if the if statement did not exist! You may want
something to happen in this case, this is where else and elseif can be
handy. For example:
$var = 'netptune';
if ($var == 'earth') {
print "Welcome to earth, enjoy your stay";
} else {
print "You are from $var, please feel free to visit Earth";
}
This says, "If $var is equal to string 'earth' ... else ... ...
---
I will stop :) Point is, we can talk about topics already covered in the
manual but in a more general/wordy way. Doing this can covertly introduce
concepts such as true/false, return, = == ===, etc. The word "covert" has
good/important meaning here.
Another important topic to be covered is how to read a man page.
Something like "man man". For example:
mixed str_replace (mixed search, mixed replace, mixed subject)
int fwrite (int fp, string string, int [length])
void var_dump (mixed expression [, mixed expression [, ...]])
Being able to decipher what those means is important, something not
everyone knows how to do. We can't rely on our versions of Common
Sense. So:
How to use the PHP Manual:
a) What Notes's are used for.
b) Why look at the See Also.
c) How to know when a function came into being.
d) How to decipher a function definition.
e) Difference between construct and function, and why I care.
f) User comments?
g) etc.
It's also worth mentioning that knowing HTML is good, and pointing to some
basic HTML resources, same with SQL, HTTP, Linux, etc. If we get
aggressive, an appendix of HOWTO's can exist on those subjects. Point
is, PHP is not Everything!
That's what comes to mind right now :)
Regards,
Philip Olson