Beginner in PHP- Help My Confused Head

10 replies
Hi guys @ Programming forum,

Strictly speaking, I normally hang out over at the copywriting/main internet discussion forum, but I decided to hang out over here now that I'm trying to learn programming languages.

I started out learning HTML and very basic JavaScript... but the more I dip my fingers into PHP, the more complex it seems to explode out at me.

I've learnt the basics at w3schools.com/php and printed out pages of types of operators, sessions, functions, etc for future reference.

I've also downloaded freesource projects like Wordpress and PHPBB, and am slowly trying to unravel the code and how it works.

The problem is... there are some quirks here and there that I don't really understand, and it's really confusing.

For example, the arrays are so confusing, as well as error_reporting, checks, the if....else , the true/false, !==....

How did you guys get so good at programming?
Any tips to share with a beginner like me?

I feel so dumb lol - i can't seem to get a footing anywhere.
Btw, picked the language up only yesterday.

horizon
#beginner #confused #head #php
  • Profile picture of the author Brandon Tanner
    Of course you're going to be confused if you've only been at it for 1 day!

    Learning PHP is just like learning any foreign language. Don't expect to be comfortable with even the basics for at least a few weeks. It's a vast language (there are at least hundreds, if not thousands of different functions), so you will never get to the point to where you know all of it (nor will you need to). After you get the basics down, just learn whatever you need to know for each project at hand, and go from there.

    2 big things that really helped me during the learning process...

    1) Don't just read about how to do something... but actually do it yourself (even if it's something really basic). Install XAMPP on your hard drive... that way you can easily test and experiment with everything you read about, which will make it easier to understand how everything works in a "live" environment. It also helps to use a "code friendly" text editor like NetBeans or Notepad++.

    2) If something doesn't make sense, cross-reference it between at least 2 or 3 other sources (different websites, books, etc). Often times one source will explain it in a way that doesn't make any sense at all, but then the 2nd or 3rd source will explain it in such a way that it "clicks".

    That said, I thought Tizag was one of the better resources for learning the basics.

    Good luck!
    Signature

    {{ DiscussionBoard.errors[5127064].message }}
    • Profile picture of the author thehorizon
      Originally Posted by Brandon Tanner View Post

      Of course you're going to be confused if you've only been at it for 1 day!

      Learning PHP is just like learning any foreign language. Don't expect to be comfortable with even the basics for at least a few weeks. It's a vast language (there are at least hundreds, if not thousands of different functions), so you will never get to the point to where you know all of it (nor will you need to). After you get the basics down, just learn whatever you need to know for each project at hand, and go from there.

      2 big things that really helped me during the learning process...

      1) Don't just read about how to do something... but actually do it yourself (even if it's something really basic). Install XAMPP on your hard drive... that way you can easily test and experiment with everything you read about, which will make it easier to understand how everything works in a "live" environment. It also helps to use a "code friendly" text editor like NetBeans or Notepad++.

      2) If something doesn't make sense, cross-reference it between at least 2 or 3 other sources (different websites, books, etc). Often times one source will explain it in a way that doesn't make any sense at all, but then the 2nd or 3rd source will explain it in such a way that it "clicks".

      That said, I thought Tizag was one of the better resources for learning the basics.

      Good luck!
      Hi Brandon,

      I guess I was a little impatient.

      If there are over 100s of functions out there... Just how would you go about knowing which function is appropriate for which?

      I've tried writing out the code for basic things like creating multidimensional arrays, connecting to SQL databases, arranging, adding, creating etc...

      Some stuff in the code of Wordpress look extremely daunting - It's amazing how people can write up a huge library of different code files all over the place, and still keep their head knowing where is which! Haha

      Thanks for the Tizag link! Will check it out.

      horizon
      {{ DiscussionBoard.errors[5127539].message }}
      • Profile picture of the author Brandon Tanner
        Originally Posted by thehorizon View Post

        If there are over 100s of functions out there... Just how would you go about knowing which function is appropriate for which?
        Just Google "PHP + Whatever you're trying to do".

        For example... "PHP get current day of the week".

        Then check out the search results, and you'll see what function is used for that.

        Someone else mentioned Lynda.com. Excellent resource. YouTube also has tons of PHP tutorials (of varying quality).

        Originally Posted by thehorizon View Post

        It's amazing how people can write up a huge library of different code files all over the place, and still keep their head knowing where is which! Haha
        IMO the best way to manage your code in a large project (besides commenting your code well), is to use LOTS of 'includes'. Instead of having just a few massive PHP files in your project, break it up into lots of small files (each one performing just 1 basic task), and then 'include' those small files as they're needed inside of your main files. Then for reference purposes, keep a single text file that lists a short description of what each PHP file is for.

        http://www.tizag.com/phpT/include.php
        Signature

        {{ DiscussionBoard.errors[5128701].message }}
  • Profile picture of the author eminc
    Hi,

    I suggest going for a step by step tutorial of PHP. As Brandon already explained, its more like learning a foreign language. Here's a learning trail that you can follow:

    0) Make a commitment to yourself that you will give X numbers of hours in learning PHP everyday/every week.

    1) Go to PHP: PHP Manual - Manual. This manual contains almost everything you need to get started.

    2) Read the getting started chapter first. Skip the installation part for now, and instead of that, go to XAMPP and install it on your machine. Installing XAMPP is quite easy (click-next).

    3) Go back to tutorial and start with Language Basics chapter and move on. Try example codes and tutorials to support your learning.

    I would recommend buying the book "Head first PHP and MySQL". All the books in this series are awesome. When you are done with this, read Professional PHP5 book.

    And if you get stuck in something, this section is the right place to post your problems

    Mohit
    Signature

    The best way to predict future is to create it ― Abraham Lincoln

    {{ DiscussionBoard.errors[5127874].message }}
    • Profile picture of the author thehorizon
      Originally Posted by Mohit Jawanjal View Post

      Hi,

      I suggest going for a step by step tutorial of PHP. As Brandon already explained, its more like learning a foreign language. Here's a learning trail that you can follow:

      0) Make a commitment to yourself that you will give X numbers of hours in learning PHP everyday/every week.

      1) Go to PHP: PHP Manual - Manual. This manual contains almost everything you need to get started.

      2) Read the getting started chapter first. Skip the installation part for now, and instead of that, go to XAMPP and install it on your machine. Installing XAMPP is quite easy (click-next).

      3) Go back to tutorial and start with Language Basics chapter and move on. Try example codes and tutorials to support your learning.

      I would recommend buying the book "Head first PHP and MySQL". All the books in this series are awesome. When you are done with this, read Professional PHP5 book.

      And if you get stuck in something, this section is the right place to post your problems

      Mohit
      Hey Mohit,

      Great stuff there! Haha, I was so right in posting my newbie thread here - the Warrior Forum is full of helpful people... Compared to HTML / JS, this language is one hell of a monster to learn... it's so broad!

      I'll definitely post any doubts/queries I have here. Looking forward to becoming a great coder - and maybe we can work on a huge project together some day.
      {{ DiscussionBoard.errors[5127906].message }}
  • Profile picture of the author SeeSharp
    Hello thehorizon,

    I know exactly what you're feeling like and how confusing it can be to start learning a programming language.
    Let me tell you how I got into it. It was about 5 years ago and my girlfriend wanted a homepage she could easily update.
    I wanted very much to give her something like that as a present although I had only little experience in webdesign and none in PHP.
    I used my wish to create something she likes to finally create a simple cms in PHP.
    Of course it wasn't that great but it was a beginning and it got me into PHP and showed me how nice it is to master it.

    What I want to tell you with this is: Don't waste too much time on tutorials, that's won't bring you much progress in your development with the programming language.
    Rather learn the basics and then head out and try to program something you like, can be a simple script.
    In the process of creating it you will get into difficulties but in the end you will solve them and THAT'S what makes you learn, not reading tutorials about it.
    Having fun with your scripts is the best way to learn.
    And after you finished your script, you can expand it and as your script expands in functionality, so your knowledge and skill does.
    {{ DiscussionBoard.errors[5128068].message }}
    • Profile picture of the author thehorizon
      Originally Posted by Exterior View Post

      Hello thehorizon,

      I know exactly what you're feeling like and how confusing it can be to start learning a programming language.
      Let me tell you how I got into it. It was about 5 years ago and my girlfriend wanted a homepage she could easily update.
      I wanted very much to give her something like that as a present although I had only little experience in webdesign and none in PHP.
      I used my wish to create something she likes to finally create a simple cms in PHP.
      Of course it wasn't that great but it was a beginning and it got me into PHP and showed me how nice it is to master it.

      What I want to tell you with this is: Don't waste too much time on tutorials, that's won't bring you much progress in your development with the programming language.
      Rather learn the basics and then head out and try to program something you like, can be a simple script.
      In the process of creating it you will get into difficulties but in the end you will solve them and THAT'S what makes you learn, not reading tutorials about it.
      Having fun with your scripts is the best way to learn.
      And after you finished your script, you can expand it and as your script expands in functionality, so your knowledge and skill does.
      Wow, that's a pretty nice thing to do for your girlfriend. Actually I'm learning it for something similar as well. : )

      Okay, I'll take your advice about the tutorials and start trying to script simple programs, and make my way up. I do need to build up some basics though - so I'll take the tips from above as well..

      Any tips on what to script for starters?
      *I can't script a CMS!?!*


      Haha

      Best, horizon
      {{ DiscussionBoard.errors[5128541].message }}
  • Profile picture of the author highrider21
    Also for wordpress, read the wordpress codex, and the book "Smashing Wordpress". I'm reading it right now and it is pretty good, although it is really above my level I can still understand it somewhat.

    But if your a beginner, you really need to learn the basics of programming in general. I took an intro to programming in C++ class on my community college and know the basic fairly well, but I'm still far away from really knowing how to program in PHP.

    Another great resource is Lynda.com. Go through the PHP essential training, I think it's more geared people who are already experienced programmers, but I found it really helpful, it goes through building a basic CMS in PHP.
    Signature

    {{ DiscussionBoard.errors[5128350].message }}
  • Profile picture of the author SeeSharp
    Just code what you want, passion is important there and with the chellange you will grow. For almost every task you can find code snippets in the net so you just need to understand and combine them but the important factor is that you want to make it.
    For the functions use google => PHP + What you want to do like PHP get random index from array.
    Wish you best luck in your progress, if you have additional questions, please ask.
    {{ DiscussionBoard.errors[5129193].message }}
  • Profile picture of the author AppleH
    I think you need learning about HTML, MySQL before learn PHP.
    {{ DiscussionBoard.errors[5129643].message }}

Trending Topics