Forum Moderators: coopster

Message Too Old, No Replies

Hands Dirty With PHP

         

zandebar

8:09 pm on Aug 4, 2010 (gmt 0)

10+ Year Member



Hi

I have just started to learn PHP and have learnt what the nobs do. LOL

I am self learning and not in an academic setting so I am not getting structured learning.

I issue at the moment is that I want to get my hands dirty, I want a good way of writting mini project and build up from there.

The thing is I don't know where to start! can some one point me in the right direction please.

Also the lack of academic structure also means that I am missing out on programming theory. Does anyone know any good site where I can learn this or a good book.

Thank You

Matthew1980

9:02 pm on Aug 4, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi there zandebar,

Welcome to the forum ;)

Firstly, check this site out: [w3schools.com ]

That site is a damn good place to start, lots of useful tips & hints, and of course php.net is always a good place to start - hopefully you have a localhost installation using something like xampp or wampp installed on your machine, this will save you having to upload scripts to test all the time.

Secondly, check out some books too (not everything comes from the web), anything from Welling and Thompson will be a good start point.

And (obviously) all the people who make this community up!

Have fun, and when your stuck, just ask, there is nothing worse than not asking, we all have to do it at some point.

Cheers,
MRb

morehawes

9:58 am on Aug 5, 2010 (gmt 0)

10+ Year Member



The official PHP documentation is a great tool with user contributed notes and examples. I have been developing in PHP for years now and it's rare to find me without one of my browser tabs pointing to [php.net ]

Depending on your programming experience there might be a bit of a learning curve to PHP but it is a very nice laungauge to write in.

Good luck!

zandebar

11:01 am on Aug 5, 2010 (gmt 0)

10+ Year Member



Thanks Guys....

I am aware of the resources that you mentioned.

Its the putting it all together; where I am struggling, as I don't want my ego get too big and I go lets build a CMS.. lol I want to take every step at a time: Crawl, talk, walk, increase vocabulary, jog, run you get the picture.

There’s no point knowing what all the whistle and bells do, if you cannot construct a script/programme effectively and efficiently. So learning programming theory is big on my agenda, this theory will then translates to any langue I choose to learn later.
It’s being able to think like a programmer; I know this will take time, time and time I will give to learning how to programme.

Also what should I begin programming at such an early stage, as I am not out of diapers when it comes to programming. Is there a website I can go, that has progressive examples to construct and build upon.

regards

Matthew1980

11:12 am on Aug 5, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi there zandebar

Good to see as you have the logical/pragmatic approach to this ;)

Start off doing string manipulation, check data types, see if you can alter them - and I *really* think as doing some regex patterns will help you out in the long run, that's my failing point, I can't do regex :(

Once you have that going go to form submission's link building & the use of query string (index.php?handle=newPage) then from that you can start on other things.

Hopefully you will understand the building blocks of php quickly as it's not that difficult ;p

Above all have fun, and just pace yourself. Again, if your stuck on something, just start a thread and there are lots of people here to help.

Cheers,
MRb

morehawes

11:34 am on Aug 5, 2010 (gmt 0)

10+ Year Member



I can't comment on being a complete beginner in PHP as my programming methodology came from my CS degree but as a beginners language PHP is an ideal place to start so you're in the right place.

Not being restricted to working with classes as Matthew1980 mentioned it's great for playing about and seeing what does what. I just did a quick book search for PHP beginners and there are lots to choose from and there are thousands of tutorials out there.

Have fun :)

zandebar

11:40 am on Aug 5, 2010 (gmt 0)

10+ Year Member



Cheers Matthew, and so quick off the mark ;)

Plenty of food for thought; TY

zandebar

11:55 am on Aug 5, 2010 (gmt 0)

10+ Year Member



@morehawes yes your right, there are thousands of tutorials out there.

Its just sorting through them, and building a structured learning pattern. As I say I have no academic structure to go by so I am left trying to structure something I know nothing about yet.

A good book is a real option when all else fails, I am intrested to learn in new media; rather than a book. To start with, and see what happens maybe I will have to give way.

I was watching the CS lessons from stanford uni last night, there focus was on JAVA an use of eclipse software. Very clever approach to learning, but I have no one to mark my work lol. Useful in a way to form a structure, as the were guiding a robot around a grid.

All very intresting; but getting feet wet is my intention, I have already constructed a simple contact form. My next step on that would be making sure the script is secure, by stripping any computer code out of the string/s.

I wanting to keep it simple to begin with, and all to easy to over complicate things in the begining. As they say foundations are the key and preperation makes you a winner.

morehawes

12:11 pm on Aug 5, 2010 (gmt 0)

10+ Year Member



I was watching the CS lessons from stanford uni last night, there focus was on JAVA an use of eclipse software. Very clever approach to learning, but I have no one to mark my work lol. Useful in a way to form a structure, as the were guiding a robot around a grid.


My degree was also based around Java. I haven't written any since but it was a very good foundation that has served me well as a web developer.

Though native PHP knowledge is the best place to start, once you have had a play and found out what PHP can do I would highly recommend checking out CodeIgniter. It's a PHP MVC Framework which I am using more and more these days. It stops you from re-inventing the wheel and also encourages you to structure applications logically. A really useful rapid development tool that will save you alot of time in the long run. It took me a little while to understand MVC but I stuck with it and I am really glad I did.

What makes CI special is the top notch user guide and there are tonnes of community tutorials out there.

rocknbil

5:05 pm on Aug 5, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



When you start tinkering always have a two thoughts in mind: security of your applications and usability for the end user. Too many programmers think, "build it first, cash the check, then make it secure, let the designers worry about all that other stuff." Somehow they never seem to get around to point #3 until it's too late, and many don't even bother with #4.

The documentation on making your applications secure is in the billions, I think, there is no one resource. here's one [webmasterworld.com] that touches on it, but if I were to boil it down to two items:

In the words of Selena Sol, every user input is a potential hack. This means query strings, form input, or Javascript used to do either, treat incoming data like the poison it is. Filter it well, and thoroughly.

So how do you begin to do that? Allow only the input you expect, and throw everything else away. This concept is deceptively simple, but it's often incredibly tedious or in cases of multiple language support with variable data content, incredibly complex. But it must be done, don't short cut it.

An example, if you expect

query-database.php?article=1234

Accept data only from $_GET, not $_POST or $_REQUEST, and make sure it's a number. If it has other restrictions, like

user-private-details.php?user=1234

You should have other internal devices (sessions, cookies, lookups) that verify this is not an attempt to access someone else's account.

"None of our users will do any of that, it won't be a problem." It's not your ordinary users you have to worry about. There are people on the 'net who have nothing better to do than ruin your day, just because they can.

The last bit of advice, make your applications valid and usable. Check your output against a validator, this really is important.

An example of "usable": instead of

- accept input
- cleanse input
- if error, echo and quit, forcing use of the back button
- sent email
- redirect to "thankyou.html"

A better experience for the end user is something like

- accept input
- cleanse input
if error, return to form with a helpful error message and all form values retained
- send email
- output a personalized email directly from this script, with helpful links to continue exploring the site.

Good server side programming is not just about learning PHP, it's an understanding of web standards, cross browser compatibility, usability, and accessibility. Explore them all.