• 0

Tips for a PHP Newbie


Question

I'm a front end "developer" meaning my advanced programming knowledge is pretty close to zero. I've been reading over w3schools and it's sinking in, a little. I've heard that you're better off deciding on a project of your own and learning as you create it (like a forum script or something), but I'm not sure really where to start.

Anyone have good recommendations when it comes to books, online literature, tutorials, or just have some tips for me to get pointed in the right direction?

I'm also wondering if it's advantageous to learn Javascript _before_ learning PHP. Right now, I'm just a Photoshop to HTML/CSS and some VERY minor jQuery guy. I think it would be useful for me to pick up Javascript as well.

I really want to branch out into web application development, though, as I have numerous ideas in my head and no way to implement them!

Any help will be met with much love :)

Link to comment
Share on other sites

18 answers to this question

Recommended Posts

  • 0

If your looking to learn php, honestly just read php.net

Start with learning how to use varibles, learn the logic, the arrays, then the functions, then move up to more advanced things such as class's and objects.

I didn't use ANY books. Just php.net. Thats the ultimate best free resource.

Sample scripts, guides, informational text etc etc etc

Link to comment
Share on other sites

  • 0

I'd agree for the most part with Klownicle. I'm a self taught PHP programmer and I just searched around for scripts, looked at the source and tried to figure out what they did and how they did it. I use php.net all the time to this day to look up functions, etc.

As for your question about Javascript - it would be useful to have a working knowledge of it to round out your skillset, but learning it before or after PHP is not going to matter. If you are a frontend person now, I'd suggest learning Javascript first though since Javascript is client-side and is more in the realm of a frontend programmer.

You're not going to gain any transferable knowledge other than general programming practices from learning one or the other because they are very different styles of languages (PHP is compiled, Javascript is not; PHP uses class-based OOP, Javascript uses protoype-based OOP, etc.).

Link to comment
Share on other sites

  • 0

Wow, didn't realize that PHP.net was so good. It does seem quite informative. Kind of like w3schools is for HTML/CSS. Thanks guys. Any more opinions are still very welcome ;)

Link to comment
Share on other sites

  • 0

Yes, php.net and get some free ready-made scripts from the internet and try to disect them into tiny bits so you can understand what the code means and how it's structured, try changing some stuff, just some general experimenting. If you don't have much spare time to experiment, just use php.net and start coding, you'll hit some bumps trying and it is just as good, however it might save you some time and frustration experimenting before you 'need' to finish some kind of script for a project. When it turns out that your code does not run, its super-frustrating, if you experiment it's not so important.

My usual m.o. for something unknown is taking a ready-made script and just edit it to fit your wishes and demands, then completely rewrite what's left into something that looks structured. Have fun!

Link to comment
Share on other sites

  • 0

PHP.net as stated earlier is a great resource for learning. Also, try W3Schools and Tizag.

My other suggestion is to download scripts, and look into their code. It may not be all that clear, but just looks and analyze them.

I'm sure you'll get the hand of it.

I learned HTML, then CSS, then PHP and finally jQuery. I can't do much raw Javascript coding because I jumped straight to the the jQuery framework.

Link to comment
Share on other sites

  • 0

Analyzing other scripts never worked for me - every time I looked at someone else code I ended up with copypasta...

For the first use I don't think that You will need book with 1000 pages. Lite and cheap books are the best for startup. They give You just the basic logic of programming language. Next step is to start Your own projects - sth small for the start, like guest book etc. As mentioned above - php.net is Your greatest friend. And of course Neowin Community ;)

Link to comment
Share on other sites

  • 0

Haha, yeah I learned HTML & CSS by reading other people's codes... I picked up a LOT of bad habits along the way and picked up a book to correct them... :)

Link to comment
Share on other sites

  • 0

Analyzing other scripts never worked for me - every time I looked at someone else code I ended up with copypasta...

For the first use I don't think that You will need book with 1000 pages. Lite and cheap books are the best for startup. They give You just the basic logic of programming language. Next step is to start Your own projects - sth small for the start, like guest book etc. As mentioned above - php.net is Your greatest friend. And of course Neowin Community ;)

Never copy code, learn it.

Link to comment
Share on other sites

  • 0

I suggest Tizag as well - http://www.tizag.com/phpT/

Then I'd probably suggest trying to write a simple register/login script (based on a tutorial on the net) - there's boat loads of tutorials on the net for this and it will introduce to using databases, using _POST variables and some functions of PHP you're likely to use a lot. Once you've got the fundamentals of writing/reading to a database you have the basis of creating any sort of dynamic webpage. Once you get to this stage I'd then suggest reading up on SQL injection, sanitizing user input and other security issues you're going to want to be aware of when using PHP.

Link to comment
Share on other sites

  • 0

prior knowledge of javascript or any other scripting/programming language would definitely make learning php much easier, but if you don't just happen to already know it, then there's no point in learning JS first because you'd still be going through the same learning curve anyways.

Haha, yeah I learned HTML & CSS by reading other people's codes... I picked up a LOT of bad habits along the way and picked up a book to correct them... :)

HTML is very prone to sloppy coding, this is much less of an issue with scripts that refuse to work if there's anything wrong at all. finer details like best practises could be picked up later without huge re-learning curves as is the case with HTML.

Link to comment
Share on other sites

  • 0

prior knowledge of javascript or any other scripting/programming language would definitely make learning php much easier, but if you don't just happen to already know it, then there's no point in learning JS first because you'd still be going through the same learning curve anyways.

HTML is very prone to sloppy coding, this is much less of an issue with scripts that refuse to work if there's anything wrong at all. finer details like best practises could be picked up later without huge re-learning curves as is the case with HTML.

I have to disagree here. JavaScript has nothing to do with PHP, (X)HTML does. Basically, PHP will usually print (X)HTML code as a result. So if you don't know how to write basic (X)HTML, you're so out of luck.

And (X)HTML is never a "prone to a sloppy coding", where did you get that from? And if a script refuses to work. It's either the code is not properly written, or the browser has terrible support (JS/CSS). HTML looks the same on every browser.

So, from my point of view, here's the right hierarchy

  1. Basic (X)HTML & CSS
  2. JavaScript (For enhancements), and it's not a necessity unless you do web design for living.
  3. PHP (or your favorite serverside language)

Take your time to learn what is most important first, good luck.

Link to comment
Share on other sites

  • 0

I'm actually reading through the book PHP6 and MySQL5 for Dynamic WebSites ... so far it's very, very good. The explanations are thorough and precise. I'll be looking for a good JS book also.

Link to comment
Share on other sites

  • 0

I have to disagree here. JavaScript has nothing to do with PHP, (X)HTML does. Basically, PHP will usually print (X)HTML code as a result. So if you don't know how to write basic (X)HTML, you're so out of luck.

And (X)HTML is never a "prone to a sloppy coding", where did you get that from? And if a script refuses to work. It's either the code is not properly written, or the browser has terrible support (JS/CSS). HTML looks the same on every browser.

not sure what you mean by saying XHTML is never prone to sloppy coding but its not very true. ive delt with people that know very little about web standards and semantics, who give me html that is riddled with poorly structured, deprecated, and some times incorrectly used tags. a good example is <br> instead of <br />. you're statement about HTML looking the same on every browser is also completely untrue. there are plenty of browsers in the world such as google chrome that support HTML5, while browsers like IE8 have absolutely no support for it.

Link to comment
Share on other sites

  • 0

I'm actually reading through the book PHP6 and MySQL5 for Dynamic WebSites ... so far it's very, very good. The explanations are thorough and precise. I'll be looking for a good JS book also.

PHP6? I think you mean PHP 5 :laugh:

Link to comment
Share on other sites

  • 0

PHP6? I think you mean PHP 5 :laugh:

PHP 6 @ Amazon

It was released in 2007, so at the time PHP 6 was in development. They later pushed a lot of those changes into the PHP 5 numbering system from what I understand. Anyways, it's still relevant :)

Link to comment
Share on other sites

  • 0

I have to disagree here. JavaScript has nothing to do with PHP, (X)HTML does. Basically, PHP will usually print (X)HTML code as a result. So if you don't know how to write basic (X)HTML, you're so out of luck.

And (X)HTML is never a "prone to a sloppy coding", where did you get that from? And if a script refuses to work. It's either the code is not properly written, or the browser has terrible support (JS/CSS). HTML looks the same on every browser.

So, from my point of view, here's the right hierarchy

  1. Basic (X)HTML & CSS
  2. JavaScript (For enhancements), and it's not a necessity unless you do web design for living.
  3. PHP (or your favorite serverside language)

Take your time to learn what is most important first, good luck.

you can write lots of complex php programs without knowing a single bit about HTML, your output just won't generally look too nice to the end user, that's all. purely in terms of how to program, though, writing JS is far more similar to writing PHP than writing markup languages like HTML and CSS are.

XHTML served as xml is not prone to sloppy coding, since - like compilers - it'll bitch at you for a single mistyped character. Every other form of XHTML/HTML are totally prone to sloppy coding though, since browsers will try to ignore and work around errors in the code, without throwing a hissy fit. And it's just plain false that HTML (or even properly written XHTML) displays the same in every browser.

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.