Beginner PHP Tutorial – 8 – Indentation

Php

Video is ready, Click Here to View ×


Facebook – https://www.facebook.com/TheNewBoston-464114846956315/
GitHub – https://github.com/buckyroberts
Google+ – https://plus.google.com/+BuckyRoberts
LinkedIn – https://www.linkedin.com/in/buckyroberts
reddit – https://www.reddit.com/r/thenewboston/
Support – https://www.patreon.com/thenewboston
thenewboston – https://thenewboston.com/
Twitter – https://twitter.com/bucky_roberts

49 thoughts on “Beginner PHP Tutorial – 8 – Indentation

  1. <?php
    $name = 'Alex';
    $age = 21;
    if(strtolower($name)==='alex'){
    if ($age>=21) {
    echo 'Youre' over 21';
    if (1 === 1) {
    echo 'Yes, 1 is equal to 1!';
    }
    }
    } else {
    echo 'Youre' not Alex!';
    }
    ?>

    in the localhost apear ——Parse error: syntax error, unexpected 'over' (T_STRING), expecting ',' or ';' in C:xampphtdocsgeorgeazipag1.php on line 6,12……………. because echo 'Youre' over 21'; is corect like this……….. no quotes after 'Youre……….and work ok……….Youre over 21Yes, 1 is equal to 1!

  2. I get "Parse error: syntax error, unexpected 'Alex' (T_STRING)" ……says line 4 error

    the second $ and age didn't turn green either

    <?php
    $name = 'Alex";
    $age = 16;
    if (strtolower($name)==='alex') (

  3. if I code that in a web, what is it useful for?  I dont' understand, If I code that in my web will apear " you are not alex, " or "ok" but what do I want that to appear in a web? I dont understand.

  4. #1 rule for success:
    If you don't want to lose viewers don't show them stuff they have not learned because they will just freak out one of the reasons Bucky is so successful is because he reassures his viewers that it's ok if they don't understand stuff he will teach them about this stuff in upcoming tutorials instead of acting like this is super basic you should understand this easy. I understand this is just for a demo and will continue on 🙂

  5. A 5 minute tutorial just for indentation? Seriously? ._.
    I love how you're explaining everything in detail but this is too much lol, pick up the pace a bit, c'mon!

  6. I hate to say it. But the PHP tutorials need extensive work. With my experience I can understand what this guy is saying but for the beginner I can imagine it would be very difficult. Sometimes it's even a little difficult for me because he is jumping around instead of staying on topic. 

  7. $var to declare variables of string and int type (at least)
    when comparing strings capitalization meters so use strtolower()  to chage everything to lower cases when comparing.   
    to ask if something is equal in the if stament use === to do the comparison (php is weird and fun).
    identatations please!

  8. Calm down people, he is talking about indentation, which is why he wrote a few lines of code without explaining. The lines of code, for now, mean nothing and are just there to explain the concept of indentation to make code more clear. Don't worry if you don't understand the code, just keep following the tutorial.

  9. }else{ an Else statement basically means, if ALL other statements in this if statement are false then do this
    echo 'You're not Alex!'; Displays the message "You're not Alex!" To the screen the backslash is to tell the program to ignore the next escape character

  10. Then;
    if($age > 21){ checks to see if the variable age is greater then 21
    echo 'You're over 21'; displays the message "You're over 21" on the screen, the backslash is to tell the program to ignore the next escape character.
    if(1===1){ checks to see if the value one is equal to one
    echo 'Yes, 1 is equal to 1!'; displays the message "Yes, 1 is equal to 1!" on the screen
    The following '}' are to close the if statements
    read next comment

  11. Its very simple, of course this comment was from 3 months ago and you probably have finished all two hundred videos. I have no, I've not gone ahead, BUT I have learned to program in other languages so this code is very simplistic to me.

    $name = 'Alex'; assigns the string 'Alex' to the variable name
    $age = 21; assigns the value 21 to the variable age
    if(strtolower($name)==='alex'){ checks if the variable name changed to all lowercase letters is equal to the value 'alex'
    Read next comment.

  12. === verifies they are of the same datatype as well as value. Ex: ('10' == 10) would return true (because the string '10' can be cast to int value 10 and vise-versa). ('10'===10) would return false (since '10' is datatype of string and 10 is not, so the datatype differs.

Leave a Reply

Your email address will not be published. Required fields are marked *