Beginner PHP Tutorial – 46 – String Functions: String Length

[ad_1]
Facebook –
GitHub –
Google+ –
LinkedIn –
reddit –
Support –
thenewboston –
Twitter –


Posted

in

by

Tags:

Comments

20 responses to “Beginner PHP Tutorial – 46 – String Functions: String Length”

  1. Mohsin Ali Avatar

    first day i completed 31 tutorial , it's my second day and 45 completed , still watching

  2. Mervin Lee Avatar

    I know that I am not even half way through the tutorials yet but if anyone has watched the whole tutorials already, could you tell me if they have a complete tutorial on how to assign password and username to users? I am currently developing a website, where users can come and learn how to play the piano but I am wondering how would I go about in doing a registration form. I have got the form ready but it is not functioning yet. Don't know what kind of code I would need so that users can immediately register and login in. I am just wondering if this would be considered a server and would I need to be connected to mysql?

  3. V. Peters Avatar

    <?php

    $string = 'Alex';
    $string_length = strlen($string);

    for($x=1;$x<$string_length;$x++) {
        echo $x.'<br>';
    }

    echo $string_length;

    ?>

  4. Elene Margalitadze Avatar

    In my opinion the variable X must start at 0 and end at $length-1, because in programming you Start Counting from 0, don't you ?

  5. Jason Armani Avatar

    If you watched any of the previous videos you will know that he includes the break tags because php code gets processed by the server and then sent to the browser. So the web browser needs to know how to go down a line. 'n' doesn't work and this makes us use break tags.
    And he's assuming that you're new to these concepts like for, while and do while loops.

  6. 0wner03 Avatar

    that's because it's an infinite loop. For loops, While loops, Do While loops can crash your browser if you make a mistake in that function.

  7. 0wner03 Avatar

    why the hell would you learn c# in combination with JS Html and CSS ?

  8. john mart belamide Avatar

    Am I learning php or just reviewing my c#, java script html and css?

  9. Medvedic Lino Avatar

    Thank you Alex,ur realy good teacher 🙂

  10. Maurice Schilpp Avatar

    Do not forget x++ because it kill my browser and my pc …O_o

  11. Optimu Prime Avatar

    u r a gr8 teacher. thank u for teaching.

  12. JMRCX Avatar

    I'm not sure if it is the same with php, but with c++ the name of the array contains the place where the variable is stored. If you use [3], it means that you go three elements further. If you use [0] you'll get the first element, the element itself.

    With length functions you logically get the amount of characters. Once you get used to is, you don't even think about it.

  13. sindarapos Avatar

    Just a bit of info on string position.

    If start is non-negative, the returned string will start at the start'th position in string, counting from zero. For instance, in the string 'abcdef', the character at position 0 is 'a', the character at position 2 is 'c', and so forth.

    If start is negative, the returned string will start at the start'th character from the end of string.

    If string is less than or equal to start characters long, FALSE will be returned.

  14. Colin Reed Avatar

    Great tutorials, but i always have to go back a little, 'cause i'm a slow typer lol

  15. kareem mohamed Avatar

    and who the fuck are you to say so, its an easy tutorial he explained it briefly and show you one of its uses, so watch the video and like or GTFO of here

  16. german77GL Avatar

    @PaT07M it does start counting in "0", but "0" is used for a empity string try doing this
    echo strlen('');//output 0
    echo strlen('a');//output 1

  17. javaken09 Avatar

    @PaT07M you can see that the loop started at 1.. and in that code he tried just to print out the numbers up to the length of the string, when you are trying to print the character itself you have to start at 0.

  18. mlg Avatar

    how do i get length of an array? like if i want to loop though an array and i don't want to set the length manual?

    thanks for the tutorial

  19. A zizo Avatar

    phpacademy by the way of thenewboston
    fantastic output 🙂

  20. supergunboy007 Avatar

    Thx Alex! Your tutorials really helped alot!

Leave a Reply

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