[ad_1]
Facebook –
GitHub –
Google+ –
LinkedIn –
reddit –
Support –
thenewboston –
Twitter –
Beginner PHP Tutorial – 46 – String Functions: String Length
by
Tags:
Comments
20 responses to “Beginner PHP Tutorial – 46 – String Functions: String Length”
-
first day i completed 31 tutorial , it's my second day and 45 completed , still watching
-
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?
-
<?php
$string = 'Alex';
$string_length = strlen($string);for($x=1;$x<$string_length;$x++) {
echo $x.'<br>';
}echo $string_length;
?>
-
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 ?
-
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. -
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.
-
why the hell would you learn c# in combination with JS Html and CSS ?
-
Am I learning php or just reviewing my c#, java script html and css?
-
Thank you Alex,ur realy good teacher 🙂
-
Do not forget x++ because it kill my browser and my pc …O_o
-
u r a gr8 teacher. thank u for teaching.
-
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.
-
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.
-
Great tutorials, but i always have to go back a little, 'cause i'm a slow typer lol
-
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
-
@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 -
@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.
-
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
-
phpacademy by the way of thenewboston
fantastic output 🙂 -
Thx Alex! Your tutorials really helped alot!
Leave a Reply