Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 10 of 10
  1. #1
    New Coder
    Join Date
    Mar 2009
    Posts
    97
    Thanks
    10
    Thanked 0 Times in 0 Posts

    Understanding PHP

    Right, so i've been learning about php for 6 months now and i still don't know how it works and i've been told this is my down to it. So is there anywhere, where i can learn how it works so i can get the "programming flow"

    /Kev

  • #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,987
    Thanks
    4
    Thanked 2,660 Times in 2,629 Posts
    Can you elaborate on what you mean by how it works? Are you asking how the interpreter passes data back and forth between C, or are you asking how the flow of a web page would go?
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 

  • #3
    New Coder
    Join Date
    Mar 2009
    Posts
    97
    Thanks
    10
    Thanked 0 Times in 0 Posts
    The flow of a web page i guess lol i've been told that i need to know "how programs flow"

  • #4
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,987
    Thanks
    4
    Thanked 2,660 Times in 2,629 Posts
    Ok.
    PHP is procedural. Starting with PHP5, they have adopted a strong interpreted object core allowing collection of properties into new data types. PHP is otherwise a datatype weak language, forcing the developer to make the necessary checks to conform the input data. All input data is a typeof string from a form, which is why PHP uses weak datatyping.
    Procedural programming involves moving from the start of the program to the end of the program, executing each command one by one. Developers write sub-routines to break from the normal procedural flow - these are called functions in php. PHP has hundreds of pre-defined functions, including extensions.

    There is no pre-set method of generating or handling data on a website. The only thing that matters is that header data is sent prior to output. This is done by ensuring any method that requires headers (header, cookies, sessions, etc) are handled before the first echo/print command including die and exit. With this in mind, cookie and session handling must occur before the printing.
    A flow for an actual website happens when a client requests data from a server. The client in our example is a web browser, and the server is a web server (we'll use apache since it is more common, but IIS is quite similar too). Apache asks the requested resource what it should do with the it, and the resource tells apache to ask the PHPModule used for apache how to deal with it (this is the settype added in apache conf file). Apache sends the data to the module which takes the page, interprets what it needs to do, and sends a result to apache. Apache then sends this data back to the client, generally in HTML format (though can be of type CSS, Javascript for text examples, and jpeg, png for binary examples).

    Is that what you're asking about?
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 

  • #5
    New Coder
    Join Date
    Mar 2009
    Posts
    97
    Thanks
    10
    Thanked 0 Times in 0 Posts
    YES! thanks a lot, i understood

    Procedural programming involves moving from the start of the program to the end of the program, executing each command one by one. Developers write sub-routines to break from the normal procedural flow - these are called functions in php. PHP has hundreds of pre-defined functions, including extensions.
    This bit only lol

    Kevin

  • #6
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,987
    Thanks
    4
    Thanked 2,660 Times in 2,629 Posts
    Ok, glad that helps!
    If you have any specific usage questions, you can feel free to post a new thread and we'll try to help (different members have different and diverse usage skills, so combined we probably have PHP down to every function).
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 

  • #7
    New Coder
    Join Date
    Mar 2009
    Posts
    97
    Thanks
    10
    Thanked 0 Times in 0 Posts
    What's the easiest way to understand and learn PHP is it reading a tutorial and actually doing a practical or just read and watch tutorials or?

    Kevin

  • #8
    Senior Coder djm0219's Avatar
    Join Date
    Aug 2003
    Location
    Wake Forest, North Carolina
    Posts
    1,301
    Thanks
    4
    Thanked 204 Times in 201 Posts
    Working through tutorials and practice are the best way, IMO, of learning any language including PHP.
    Dave .... HostMonster for all of your hosting needs

  • #9
    New to the CF scene
    Join Date
    Oct 2008
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Kev0121 View Post
    What's the easiest way to understand and learn PHP is it reading a tutorial and actually doing a practical or just read and watch tutorials or?

    Kevin
    I'm not sure if we can post links, but two really good php resources I remember are hudzilla php guide and PHP101 is great for beginners. I think you can google for those easily.

  • #10
    New to the CF scene
    Join Date
    Feb 2009
    Location
    Chicago
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    it is true.

    Learning is best with a lot of reading and practice in the same time. I know that from my experience.

    Mark Johanson
    Last edited by Fou-Lu; 03-04-2009 at 11:03 PM. Reason: Spammy Link


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •