how does if then or any kind of statement work.....

4 replies
IN PHP if you just wanna build a great looking website; whats the point of the statements; dont mind me im just a rookie in php so pardon my duh moment with php
#kind #statement #work
  • Profile picture of the author nmwf
    Programming statements or comments?? Programming statements are required. In fact, you can't program without them!! Not clear on what you're talking about here.
    Signature
    Write comprehensible articles on *any* topic in seconds with First Draft...
    First Draft's: Download | Add-Ons | Templates | Purchase | Support | Affiliates
    {{ DiscussionBoard.errors[10059755].message }}
    • Profile picture of the author Gordon24
      If you have ANY underlining logic in your website, you will probably need to use statements. Besides, PHP is very powerful programming language, and statements are literally one of the first concepts tutorials cover. The understanding of basic programming language concepts will always come in handy.
      {{ DiscussionBoard.errors[10061194].message }}
  • Profile picture of the author Cosmit
    PHP Code:
    if(isLoggedIn()){
        
    showCommentForm();
    }else{
        
    showLoginForm();

    Any questions?
    {{ DiscussionBoard.errors[10077002].message }}
  • Profile picture of the author samntly
    Taher the best way to describe it is to think of a programming language as a brain with strict rules. I can't explain these in details here but they apply to most programming languages. (try W3Schools Online Web Tutorials for more information)

    One of those rules uses conditional statements which means if this then do that or this.

    So if someone asks you "Do you have to go to work today?" then your brain does this very instantly, almost even without you noticing:
    - Bring back today.
    - Today is Sunday
    - I don't work on Sunday
    - So you respond no I don't have work today.

    So in code it would be like:
    1) First find out if you know what today is (I know sounds crazy)
    today = Sunday

    2) Find out if I work on Sunday
    Monday = work
    Tuesday = work
    .....
    Sunday = off

    Response - I have today off. That's conditional.

    In programming you can use it for lots of reasons such as:
    - if the password is not correct then show "You've entered an incorrect password. Please try again".
    etc.....
    Signature

    Need A PHP Programmer That You Can Count On, That's Professional, Experienced in working with small and large clients. Reach me on skype at "Netlyte" or visit me at http://www.LCCWebDesign.com

    {{ DiscussionBoard.errors[10098111].message }}

Trending Topics