Most Burning PHP Questions

excitingwonderlakeInternet και Εφαρμογές Web

13 Δεκ 2013 (πριν από 4 χρόνια και 6 μήνες)

103 εμφανίσεις

Copyright © 2009


All Rights Reserved


Most Burning PHP Questions

Robert Plank

Hello there, this is Robert Plank, and today let's talk about your most burning questions
about PHP. If you want to check me out on the web, my URL is at

So let's get started with the firs
t question, which was "What the heck is Web 2.0? I thought
that I was on the web, now suddenly there's a 2.0 of the web."

Web 2.0 is a bunch of hot air. It's just something that people like to talk about

like artsy
fartsy programmers and artsy fart
sy business people and artsy fartsy content creators.

You have Web 1.0, where you do things like set up web pages

like static web pages;
videos, which are just only made by you, and so on

but then you've got Web 2.0, where
you've got the social me
dia stuff, the social networking. You've got YouTube sites, where
anybody can upload a video, or Facebook, where you can add a bunch of stuff about
yourself and upload your photos and network with friends. The same thing with MySpace
and Digg.

So a si
te Digg is where people submit news items, and people vote them up; so the site
totally runs based on the user input.

Then there's other ideas in Web 2.0, like data portability. So if you joined Facebook, it
asks if you want to log on to your Hotmail t
o grab all your contacts to add those as your
Facebook friends.

Or you got things like full RSS feeds, so you have your blog and you have this XML file

this little data file of your most recent news items

and usually those are just excerpts so
t people can subscribe to your feed, but other people can make them the full, entire
blog post. So people subscribe to the feed, and they can read everything on your blog
exactly without even going to your web page. They just read it from their RSS reade
r, or
they can import those posts onto other blogs so data gets moved around.

And then you've got the semantic web, which means

you know how you've got HTML
files and you have opening and closing tags? And you have only certain tags that you're
d to have, like paragraph tags, bold tags. But semantic web means we have
different formats.

For example, we might have an iCard. I don't know if you've ever seen this, but this is a
way somebody puts in an XML file. It looks like an HTML file, but t
he tags have different
names. They can put stuff like their contact information into this XML file. Then you click
on it, and it automatically adds that person as a contact in your Outlook or in whatever
program you use to manage your contacts.

And yo
u can do the same thing with appointments. Take an appointment; save it as a
special vCard or iCard file, which is an XML file; upload it; and then when somebody clicks
on this, it will add whatever appointment you choose

with whatever title and descri

Copyright © 2009


All Rights Reserved


and location and time and date

it will add that to their calendar. So if you've got an
upcoming seminar or an upcoming meeting or whatever, you can make it very easy for
them to read that using different programs.

Okay. So that's all you need t
o know about Web 2.0. All it just means is that you can do
things like allow users to add comments to blogs. You can blog yourself, and you no
longer have static sites. A static site is just an HTML site, but a Web 2.0 site is a dynamic
site where peopl
e can upload YouTubes, comment on YouTubes, leave Facebook
comments on each other's wall, vote up a story on Digg

all that good stuff.

So if you hear somebody talk on and on about Web 2.0, he's probably some kind of digital
hippie, like a 21st centur
y hippie who's just talking about how "Everything should be free.
Everybody should want to exchange ideas." I'm like, "Okay. You're boring me already."
And then some of these guys get crazy, and everybody's talking about Web 2.0, so some
of these guys
go and talk about Web 3.0. I'm like "Okay, great."

Technically, Web 3.0 is supposed to be if someday the internet becomes three
dimensional. So you look at a screen and you see two dimensional. If someday it
becomes three dimensional, that will be We
b 3.0. But a lot of these people who like to
invent new words, they will say Web 3.0 just as saying "It's like Web 2.0, but even more."
And it's just stupid. So if you hear Web 2.0, just think YouTube, blogs, MySpace, Digg,
and you'll be good.

So why s
hould you choose PHP? Why should you make these Web 2.0 sites instead of
regular HTML sites? Well, HTML is static. So you write something once; you upload it;
and it always appears that way.

But PHP is dynamic so the code is interpreted. So you can
add in some code on a PHP
file that will show the current date. When somebody loads that page, your web server will
do some thinking and say "Okay. I want to show them the current date." Then it loads on
their browser, and if they view the source code,
it looks like a regular, static HTML page
but it's regenerated every time they load that page from a web server. So people can sign
up to Facebook or log in to Facebook, and the page changes depending on what they did.
Or you can post to a WordPress blog
, and the blog changes depending on what post they
added, and so on.

So you can make the web page change, and you go and talk to a database depending on
how you do the programming. So it's not just always set in stone. It will change over time.

framework should you use? Maybe you've made a few PHP scripts, and you hear
about stuff like framework. So you've got things that will allow you to make content sites
really easy or mess around with a database really easy or make different pages really

You just got all kinds of different tools like CakePHP, PHP Inferno. I can't even think of all
of them, but there's all these frameworks that add tons and tons of extra tools that PHP is
lacking to make it quick for you to whip up some application
s. The problem is that all
these frameworks contain hundreds and hundreds of extra PHP files; so it slows your
scripts way down and makes them humongous

makes a script that used to be 20

makes it several megabytes.

Copyright © 2009


All Rights Reserved


It's too much stuff t
o learn becase you might spend all this time learning your framework,
and then it turns out that that's no longer the correct framework. Me, personally, when I've
tried to install a lot of these frameworks, they require you to change the PHP settings. So

from my point of view, it's not really worthwhile to mess around with frameworks

because if I need to install them on other people's web servers, it's just not going to install
right; so the customer support would be a nightmare.

For me, it's easier

just to write stuff from scratch. If I have some kind of PHP code that
messes around with a list or messes around with a text file or reads through a database, I
will reuse that for my next script. I'm just a fan of reusing code instead of learning a

The exception to that is that maybe in a few years the Zend Framework, which is made by
the creators of PHP. If that ever is a bundled part of PHP

just like how MySQL is built
into PHP. I have no problem with teaching stuff that's built

to PHP. I have no problem
learning stuff that is guaranteed to be built
in to PHP. I just don't want to add this extra
stuff that's hundreds and hundreds of files.

So the creators of PHP are working on a framework called the Zend Framework. If it ev
becomes a built
in part of PHP, then you should learn it; but otherwise a lot of these
frameworks are made by script kiddies or just people who have bad design skills and who
don't care if you have to edit special files to get the PHP script to work or
if you have to
recompile PHP or redo your web server. They don't care about that.

So just from the point of view of being able to put your scripts on other servers and
because it makes them huge and it's too much stuff to learn and it slows them down,
would stay away from most frameworks.

And when people want to learn about PHP, they always want to know about the history. I
usually skip over that because it's like who cares? But if you're curious, here's what PHP
is all about.

The first version
was a set of Perl scripts. So back in the mid
90's, it was popular to write
your web
based scripts in C++, but then that got replaced by Perl. So in the late
90's it
was all about having Perl on web pages.

I remember when I was 13
old, I went to

the bookstore, and I bought a book on Perl.
I understood about half of it, but I didn't really understand enough to mess around with
anything. I wish that I'd paid more attention to that because then maybe I'd be a couple
years ahead of where I'm at now

as far as knowing programming languages.

But it was a set of Perl scripts. If you've ever looked at Perl code, it's nice and you can do
a lot with it, but it's really, really messy. I consider Perl to be the write
once, read
language, because y
ou write stuff and then you look at it and say "What the crap did I just
write?" Somehow it works; it's magic, but it just looks like crap.

So the original version of PHP was just for personal homepage tools. It was a set of Perl
scripts just to make
things easier. And then they rewrote it in C, called PHP/FI and PHP/FI
2. The advantage of PHP is you have all these built in helper functions to do stuff like read

Copyright © 2009


All Rights Reserved


stuff from strings and mess around with arrays and output stuff and sandwich stuff in
ween HTML. So they rewrote it in C later on.

In 1997, what I consider to be the real, first version of PHP, was called PHP 3.0.

So you had this PHP stuff that you could insert right in between HTML, and it was gaining
popularity, and they added stuf
f where you could mess around with databases. But the
real grown
up version of PHP came in the year 2000, which was PHP 4. This was around
the time when I started learning PHP, and they let you have objects. You could group your
functions together, and
they had what's called the Zend engine; so PHP scripts ran very
fast, and you could have output buffering, so you could run what would normally be output
through some kind of a filter like a search and replace or something.

And they added lots of cool s
tuff like the Zend encoder so you could encode your PHP
source code. At the time I'm recording this video, this is still what I use because you
always want to wait a couple of years when something is new before you really go for it full
blast. A lot of w
eb hosts still run PHP 4 just because they don't want to break all the
existing scripts. For now, I'm still making scripts in PHP 4. I'm sure in the coming years I'll
have to make sure my scripts run in both PHP 4 and PHP 5. Then years after that, once
they start to phase out PHP 4, I can just worry about PHP 5. But, of course, once PHP 5
becomes the standard, then they're going to start phasing in PHP 6. That's just the way
life works.

So in 2008, PHP 5 came out, which had a better Zend engine and us
ed stuff like name
spaces, where you could set a variable in one spot and set a variable in another spot, and
it would be totally independent from each other; built
in XML processing, so you could look
at RSS feeds or affiliate data feeds and create your o
wn XML functions and a lot of stuff to
make the syntax better.

What they're doing is they're trying to make PHP more like a programmer's kind of thing.
So in PHP 4 you could just set a function and just set a class, but in PHP 5 you can add
So say if you have this function, only this other function can talk to it, and so on.
They're getting it to be less like a script
kiddie newbie language and more like a
programmer language, which is both good and bad because it means that it's easier to
rite secure code, but it also means it's tougher to teach. There's more stuff to teach.

What are the advantages of PHP? Well, PHP will run the same code on both Windows
and Linux servers. I think even Mac servers will run PHP. It has a lot of built

functions, because in most languages you have to figure out "What file is this in? What
library? I have to import it and type in a super long function name." But in PHP, they have
in stuff, like stuff to send e
mail and to read text, to me
ss around with databases. And
you can insert it right into HTML; so it has an easy learning curve.

You can just take your regular HTML page and in one little bit of PHP code to display the
date or display the year or display somebody's first name. It'
s also weakly
typed, which
sounds like a bad thing, but if you're a newbie it's a very good thing. So if you have a
variable and it's set to a string

so if you look at this code here we say "dollar sign i
equals five semicolon," and the five has quotes

around it. So in programming, you can
have a number. And if you have a number, you just have the number five. But if you have
a bunch of text like "hello there," you would put it around double quotes. So what we have

Copyright © 2009


All Rights Reserved


here is a little bit of text; so i
t's the test of the number five, not actually the number five. It's
a representation of the number five.

But if we take that and we say "show us i plus one," even though it's just a representation
of the five, it will convert that into a number and add

one and output six. So you don't have
to worry about "Is this data type a bunch of text or a number, or is it a decimal number?" or
whatever. PHP will try its best to keep your script from failing. And if you tried this same
thing in a grown
up languag
e like Java or ASP.NET, it would not work at all. You would
have to specifically say this is a number, and then you can do addition to it.

So what's the difference between PHP 4 and PHP 5? They have just added stuff to make
it more helpful for programme
rs, not helpful for newbies.

So there's things like class destructure. So if you have some code and you want to create
a new object to do some stuff, then when you close the object, you can run code to clean it
up. So say you have an object representi
ng your database connection, and you say "I
want to connect to this database and do some stuff, but after we're done, I want to close
out the connection to the database." You can have abstract interfaces, so you can say "I
want you to be able to make this

group of functions, this class of functions, but I only want
you to be able to add in these specific things that do this and this and this." And if you
added some extra function that behaved differently, it would error out.

And they've got better MySQ
L stuff so you can connect to MySQL over a secure line and
add in bound statements. They've got built
in SQLite so you can save stuff in a database
into a text file. So you save stuff in a text file. It acts as if it was a database with rows and
but it doesn't actually connect to a MySQL database.

And just iteraters to step through objects better. So if you have a group of objects, like a
list of students in your class, there are ways to make it look prettier instead of having to
mess with arr
ays and make your own data structures and stuff. It's easier to step through
those things.

So the difference between PHP 4 and PHP 5 is that it's just helpful more for programmers,
makes you write better and more secure code, but makes it a little toug
her for the newbies.
But hopefully if you're a newbie you don't need to learn this stuff right away; so you can
just learn the basics. For now, PHP 5 is still very friendly for newbies, because you can
just start off by making a few functions, and you ca
n still sandwich in stuff between HTML
code. They're still trying their best to appease both sides.

Another question I get asked a lot is "What does PHP stand for?" My answer to that is
does it matter? It doesn't. Just call it PHP. But if you really
want to know, PHP stands for
PHP: Hypertext Preprocessor. So the letters are PHP, but the P itself stands for PHP. So
it's a recursive acronym, which means that it keeps going on forever and ever, but the
meaning behind PHP: Hypertext Preprocessor

ell, hypertext means it's on the
worldwide web. When you type in http:// to go to a web site, that means hypertext transfer

So hypertext is just what you get on the internet. There's text, and then there's hypertext,
which means you can have

html tags and bold tags and video and stuff. The hypertext
part means it's for web servers, and the preprocessor means that your web server's going

Copyright © 2009


All Rights Reserved


to process some stuff. So maybe you have code to show the current date. It's going to
figure out that da
te and then display it so your end users don't have to worry about it. Your
web server does all the work.

What's the future of PHP? Don't worry about it for a while, but in PHP 6 they're going to
have Unicode support. So it's going to be easier to proc
ess text that's not English, like
Japanese text and stuff.

And they're going to have better XML support, so more of this Web 2.0 data portability
stuff is going to be easier, so you're going to have stuff like

say you have The Weather
Channel, and th
ey have a data feed of today's weather patterns. You look up a zip code,
and they'll give you the temperature and the forecast. And with PHP 6, with all the built
XML stuff, you should be able to just put in a URL data feed and add a few lines of code
and it will give you all the information you want. As it is right now, it's still kind of tricky, but
they're going to make it more easier for programmers to do more powerful stuff, maybe
more object
oriented like Java. And hopefully it becomes more dr
drop. If you've
ever coded stuff in C# or Visual Basic .NET using Microsoft stuff, you open up a program
and you drag stuff in. You just set a bunch of settings, and it does 90 percent of the
coding for you just by putting all these settings in.

Delphi for PHP is trying to make it like this, where if you want to connect to a database,
you just drag a database object over. If you want to add some text, just drag it over. If you
want to add a table, you drag stuff over. It'll take them a few mo
re years to get it
perfected, because it's still not that great so don't worry about it for a while.

What is my PHP setup? I don't bother with a local install. I know many people, when they
give PHP tutorials, the very first thing they teach you is how
to set up MySQL and PHP
and Apache on your own web server. I don't bother with that. I just save it over to my web
server, and I have a text editor called EditPlus with built
in FTP. So I can browse my FTP
server as if I was browsing from my text editor
, open up a file, edit stuff, and as soon as I
click save it uploads it back. That way I can work on it from anywhere.

And the main reason I did this is because years ago I used to have my own local PHP
Windows machine, and I perfected this script. I
spent a year on this one script, but then
when it came time to upload it to Linux, it behaved differently, and it had all kinds of errors.
So I'd rather just edit stuff in the exact same environment that I'll be expecting my script to

Another common


Do I need a degree to learn PHP? Let me tell you about stuff
I learned. I learned PHP in high school in my junior year, because I had to do it for a
school project. I had to catalog some pictures in an art gallery, and I would have spent al
semester coding up some static HTML pages; so I decided to spend a couple weeks
learning PHP, and I had that done in about a month or so.

So I learned PHP in high school in my junior year, and yeah, I am the kind of person to
mess around on a computer
. I knew a programming language from when I was a kid, but
not really anything super complicated. It was just some really easy stuff.

So I learned PHP in a few weeks or a month when I was a junior in high school, age 16, no
college degree. The next y
ear I learned C++, and I learned that in a week because I

Copyright © 2009


All Rights Reserved


already knew PHP. Once you know one programming language, it's really easy to pick up
stuff like C++ and Java and Perl and C#. A lot of the learning is the ideas. Once you get
the ideas that most

programming languages have, it's pretty easy to learn everything else.

Because I already knew PHP, I learned C++ in about a week senior year. And then when I
started college, I learned Java in about two weeks because Java is even more similar to

And then later on in college when I was a student assistant, I had to learn Perl to
edit some scripts. The guy gave me a book, and in a week I read through the book and
learned Perl enough to make my own Perl scripts and mess around with some other guy's

Perl scripts.

And then at age 22 I graduated college, where I already knew four major programming
languages. And then shortly after I had to learn C#, which was very similar to C++ but it
had a lot of that drag
drop stuff, and I learned that in tw
o weeks.

Once you know one of these languages, learning another language is all about syntax.
And you don't really need a college degree to learn it. You need to have the right mindset
and be excited about it. You need to be the kind of person who ge
ts excited to write a
program, and if you're not that kind of person, then you should probably outsource your
PHP development. But if you get excited about debugging stuff or making a program that
can save time, then go ahead and do it.

So how do you kno
w if you are the kind of person to think like a programmer?

Do logic puzzles, because real companies, when you go to interviews, some of them will
ask you about programming logic

like if you have this setup, how would you structure
this database? An
d some of them will use logic puzzles as an intelligence test. Many
people, if you ask them some weird question like "How many gas stations are in the U.S.?"
they'll just give up. But if you're a logical, programmer
type of person, you'll be breaking
n the problem. You'll be trying to figure it out. It doesn't matter if you can solve it
correctly, just how you break it down.

So if you asked somebody "How many gas stations are in the United States?" they might
say, "Okay. Well, here's the number o
f cities. Here's the average number of gas stations
a town might need, and if I was thinking about it in terms of capacity, every gas station has
on average maybe two cars in there. Let me estimate how many people are in the country
and how many cars the
y have." Just think about things logically. If a number sounds
about right, it doesn't matter if it is right, just that you thought about it.

So if you find a site like this really fun, then you might have a programmer type of mind.
So we have this s
ite with all of these different things they ask you in job interviews.

So you might have a thing like this: Two math graduates bump into each other while
shopping at Fry's. They haven't seen each other in over 20 years. The first guys says,
"How have
you been?" "Great. I got married and have three daughters now." "Really?
How old are they?" And he says, "Well, the product

so all of their ages multiplied is 72,
and the sum of their ages is the same as the number on that building over there." He

says, "Okay, I still don't know."

Copyright © 2009


All Rights Reserved


He says, "Well, the oldest one just started to play the piano." And then suddenly he gets
it. So how old was the first graduate's daughter? If you just give up on this, you're
probably not a programming type. But i
f you start thinking in terms of "Okay, what
information did he just give me? Let's break this down. We're going to say he has three
daughters. Let's call them D1, D2, and D3. So D1 times D2 times D3 equals 72." And so
what you're going to want to do
is figure out all possible combinations.

So let's say the first daughter is 1 years old, the second daughter is 1 years old, and the
next one is 72. That equals 72. Let's say the first daughter is 1 years old, the next one is
two years old, and that w
ould make the final one 36, which is equal to 72. Then you would
end up doing this for 1 and 3 and so on. Then you would look at it from there.

So let's see what the solution is here. They listed it out just like this

cool. They listed it
out jus
t like so this times this times this is 72; this times this times this is 72. They listed
them all out. So the way that you would solve this if you had a computer program would
be the exact same way. You would first list out all of the 1's and try to in
crease this, and
then try to increase this to see how many combinations of numbers all

when you times
them together

go to 72.

So he gets the sum of all the possible ages, because we talked in the problem here about
how he talked about the sum of t
heir ages is the same as the number on that building, but
he still didn't know. But then when he said the oldest one started to play the piano, he said
"Okay. Now I get it." What's the difference here?

The difference is that

he had to have before
you told him that his oldest one started to
play the piano, he didn't know, but afterwards he did. The clue here is that it's the oldest
one. So you list all these out, and if you look at this right here, these are the only two
combinations where the sum

of the ages are the same. So you assume that because
they're math graduates that they can do lots of calculations in their head and they're doing
all this in their head. So he says, "The sum of all my daughters' ages is the number over

that 14.
" So he says, "It could be one of these two." Then he says, "Well, my
oldest just started to play the piano." So he can say, "Well, these two oldest are twins, so
there is not an oldest. They are the same. But this one, the 3
olds are twins, and
oldest daughter is 8. So I know that my oldest daughter is 8

It doesn't matter if you got the right answer, just how far you got. So maybe you got to the
point where you started listing the ages and you gave up. That's fine. Or mayb
e you
figured it all the way out or just how you wrote out the problem and how you would solve it.
That's all that matters. I have a lot of fun sometimes looking at these different solutions.

How's this one? The rope bridge. So we talk about four peopl
e need to cross a rickety
rope bridge to get back to their camp at night. They have only one flashlight, and it only
has enough light left for seventeen minutes. The bridge is too dangerous to cross without a
flashlight, and it’s only strong enough to sup
port two people at a time. Each of the
campers walks at 1 minute, 2 minutes, 5 minutes, and 10 minutes. How do they make it
across in 17 minutes?

Copyright © 2009


All Rights Reserved


Okay, so the bridge holds two people. 17 minutes on the flashlight. So we have to do it in
17 minutes,
otherwise it'll get dark

or it is dark, I think. Yeah, it is dark now. The
flashlight has 17 minutes.

We have different people here. We've got the 1 minute, the 2 minute, the 5 minute, and
the 10 minute. And you only have one flashlight. So this
relates to computer science
because you always have problems you need to solve, and there's always no right way to
do it, so you have to figure out the fastest way to do it.

So it's like this: We've only got one flashlight, so my first idea is to have t
he fastest guy

is the gopher. On this side of the bridge we have 1, 2, 5, and 10. On this side we have
nobody. So I'm going to have the first guy take guy No. 2; so we are left with 5 and 10
here. And we have the 1 and 2 over here. So this is 0 min
utes. This means we took 2
minutes, because the first guy had to wait around for the 2
minute guy. Then the first guy
goes back; so now it's 1, 5, 10, and just the 2. So this is now 3 minutes. Then he'll take
the 5
er across. So just leave the 10, and

now we have 1, 2, 5. So that took us 5 minutes.
Now the total is 0 minutes; the total is 2 minutes; the total is 5 minutes; and the total is 10
minutes here. Then have the one guy go back; so now it's 2, 5; and that took him one
more minute. Shoot

I screwed this up here.

Oh, I am doing the total here

my bad. So this was 3 minutes; so just the 2; then 1 and 5
came over; so this is now 8 minutes. And now we're at 9 minutes for when he comes
back. So these two guys are going to cross. Now we'v
e got 1, 2, 5, and 10, and that took
us 19 minutes. So that didn't work. The flashlight died when we were most of the way
across the bridge; so we need to think of a different way.

The slowest two guys are going to be the 5 and the 10, because just from
trying this out,
we realize that if we have to take the 10 all the way across and the 5 all the way across,
we wasted 15 minutes. So what if we had the 5 and the 10 go across at the same time.
So then we'll say "Get the 5 and the 10 to cross at the same
time," but we don't want them
to cross immediately because then the 5 will take forever to come back.

So we want to have the fast guys cross first. So let's have these two guys cross first. We
have the 5 and the 10, and the 1 and the 2 cross over. So
that means it took us 2
minutes. And then let's have the 2 go back. So now we've got 2, 5, 10, and the 1 here.
So now we just spent 3 minutes. And now the 5 and the 10 will cross together. So we
leave the 2 here, and the 5 and the 10 cross together.
Now because we have this one fast
guy here, he'll be able to come back very quickly. So the 5 and the 10 cross, and that
takes 10 minutes; so it's now 13 minutes.

Then we have 1, 5, and 10 here. Then we have the 1
minute guy go back; so we have 1
and 2
, 5 and 10. So that took him 1 minute to get back. And then we have the 1 and 2
cross together. Now we have 1, 2, 5, and 10, and it took 16 minutes.

So again, it doesn't really matter if you got this correct, just what strategies did you try.
You fir
st would try the fastest guy as a gopher. Maybe you might have tried to have the
middle guys go or something, but just the idea is that you abstract this and make the
problem simpler so you can solve it. That's how you figure out if you can think like a
programmer. If that kind of stuff is fun for you, then you might be.

Copyright © 2009


All Rights Reserved


Is PHP secure? That's a question I always get. PHP does stuff like, by default, it hides
errors. Whenever something in a script has an error, then people might use that to make
break. So by default, PHP 5 will show you a blank screen if there is an error, which is
bad if you're debugging. But if you're showing your site to the outside world, that's good.

There's always going to be SQL injection attacks, which is what most peo
ple talk about
when a language is supposedly not secure. That's going to happen in just about any

in Oracle, in C#, in Java. There's always going to be these SQL injection
attacks. That kind of stuff is where people can insert bad code into
an input they give to
the script. That's just up to the programmer so that kind of thing about making PHP
secure, if you have a good programmer, then he'll make it good.

The only problem is that the weakly
typed stuff and the variable assumption will hu
Remember how we could have a string that represents five and add a one to it, and it
assumes it's a number. So things like that will get you into trouble, but if you're a good
programmer and if something you're dealing with is supposed to be a number
, make sure
that you convert it into a number using intval to make sure it's a number.

Variable assumption will hurt, too. So a variable assumption is when you can start

normally you would have to declare a variable in most languages. You can s
ay "counter
equals zero," and then you can add stuff. But in PHP, you can say "counter equals
counter plus one," and it will always automatically assume the counter is zero. So just
make sure that you always declare variables to keep people from sticking

them in.

You can be secure if you just have good programming practices. Even if there are little
security holes in PHP, as long as you think about how many possible ways can somebody
screw this up, then you'll be better. There are insecure scripts in
any language.

My favorite PHP site is

well, when I first learned, PHP Monkey had some good basic
tutorials. If you want some hand
holding, check out my 5minutePHP site

hint, hint. But
now I will look at something like PHP Architect, where every onc
e in a while they'll have
some article about something new and something crazy.

And then as far as a forum, I like DevNetwork because you don't want to be learning PHP
and hanging out on a marketing forum. You're going to want to hang out on a PHP forum
So that's a good place where, if I want to go help some people solve their PHP problems,
I'll go there. If I have problems of my own, if I don't know how to design something,
sometimes I'll hop on there.

And the final question is some guy said "Should
I start my own YouTube?" This is the kind
of situation where you will be tempted to remake the wheel. So before you go off and
make a script from scratch, look and see if there's already something there. So if you're
going to make your own YouTube, go a
nd see if there are some YouTube clone scripts out
there because there are. Don't waste three months making this from scratch if you can
spend three weeks tweaking a script that already works.

So those were your most burning questions about PHP. That's a
ll from me for now. I'm
Robert Plank. If you want to check out more of my PHP stuff, go to

Robert Plank