Difference between revisions of "PHP-and-MySQL/C2/Variables-in-PHP/English-timed"

From Script | Spoken-Tutorial
Jump to: navigation, search
(Created page with '{|Border=1 !Time !Narration |- |0:00 |Welcome to a basic tutorial on PHP variables. |- |0:04 |Let me quickly go through a few things first. |- |0:07 |PHP variables are very eas…')
 
m
Line 1: Line 1:
 
{|Border=1
 
{|Border=1
!Time
+
|'''Time'''
!Narration
+
|'''Narration'''
 
|-
 
|-
|0:00
+
|00:00
 
|Welcome to a basic tutorial on PHP variables.  
 
|Welcome to a basic tutorial on PHP variables.  
 
|-
 
|-
|0:04
+
|00:04
 
|Let me quickly go through a few things first.  
 
|Let me quickly go through a few things first.  
 
|-
 
|-
|0:07
+
|00:07
 
|PHP variables are very easy to use; I'm sure you'll understand them straight away.  
 
|PHP variables are very easy to use; I'm sure you'll understand them straight away.  
 
|-
 
|-
|0:14
+
|00:14
 
|You don't need to declare them and they're quite easy to write.  
 
|You don't need to declare them and they're quite easy to write.  
 
|-
 
|-
|0:18
+
|00:18
 
|You can add a value to a variable half way through the script.  
 
|You can add a value to a variable half way through the script.  
 
|-
 
|-
|0:23
+
|00:23
 
|Also, they automatically convert to the data type you require.
 
|Also, they automatically convert to the data type you require.
 
|-
 
|-
|0:28
+
|00:28
 
|So there's no need to declare them in a different way each time, or create a value for them each time.  
 
|So there's no need to declare them in a different way each time, or create a value for them each time.  
 
|-
 
|-
|0:36
+
|00:36
 
|So, for example, let's create our PHP tags here and our content goes in between.  
 
|So, for example, let's create our PHP tags here and our content goes in between.  
 
|-
 
|-
|0:41
+
|00:41
 
|Okay. Now we start with the dollar sign and then we have our variable name.  
 
|Okay. Now we start with the dollar sign and then we have our variable name.  
 
|-
 
|-
|0:48
+
|00:48
 
|Please note that you can't start with a "number". So I can't start with a '1'.  
 
|Please note that you can't start with a "number". So I can't start with a '1'.  
 
|-
 
|-
|0:53
+
|00:53
 
|What I can start with is an "underscore" or a "letter".  
 
|What I can start with is an "underscore" or a "letter".  
 
|-
 
|-
|0:57
+
|00:57
 
|No other special characters are allowed except underscores, letters and numbers, as long as it doesn't start with a number.  
 
|No other special characters are allowed except underscores, letters and numbers, as long as it doesn't start with a number.  
 
|-
 
|-
|1:06
+
|01:06
 
|So that would be perfectly acceptable here.  
 
|So that would be perfectly acceptable here.  
 
|-
 
|-
|1:09
+
|01:09
 
|Okay, so I'll create a variable called "name" and that's going to be equal to a string value contained within double quotes, just like we used for the "echo" function.  
 
|Okay, so I'll create a variable called "name" and that's going to be equal to a string value contained within double quotes, just like we used for the "echo" function.  
 
|-
 
|-
|1:21
+
|01:21
 
|'My name is Alex'.  
 
|'My name is Alex'.  
 
|-
 
|-
|1:23
+
|01:23
 
|On the next line, we're going to create another variable using a dollar sign, called 'age'. That's going to be equal to '19', without double quotes.  
 
|On the next line, we're going to create another variable using a dollar sign, called 'age'. That's going to be equal to '19', without double quotes.  
 
|-
 
|-
|1:33
+
|01:33
 
|Now the reason for this is that this is an integer.  
 
|Now the reason for this is that this is an integer.  
 
|-
 
|-
|1:36
+
|01:36
 
|You can use it for decimal values as well.  So this could be '19.5' or nineteen and a half.  
 
|You can use it for decimal values as well.  So this could be '19.5' or nineteen and a half.  
 
|-
 
|-
|1:43
+
|01:43
 
|That would also automatically convert this into a decimal.  
 
|That would also automatically convert this into a decimal.  
 
|-
 
|-
|1:48
+
|01:48
 
|However, at the moment it's just an integer. That's how I want it - the variable 'name' is a string and the variable 'age' is an integer.  
 
|However, at the moment it's just an integer. That's how I want it - the variable 'name' is a string and the variable 'age' is an integer.  
 
|-
 
|-
|1:57
+
|01:57
 
|So let's try echoing these out.  
 
|So let's try echoing these out.  
 
|-
 
|-
|2:00
+
|02:00
 
|What we need is "echo" and the variable name, not forgetting your line terminator.  
 
|What we need is "echo" and the variable name, not forgetting your line terminator.  
 
|-
 
|-
|2:06
+
|02:06
 
|Okay, let's find our file named "variables".  
 
|Okay, let's find our file named "variables".  
 
|-
 
|-
|2:11
+
|02:11
 
|Okay, "Alex" has been echoed out, just like I've said here, "echo name".  
 
|Okay, "Alex" has been echoed out, just like I've said here, "echo name".  
 
|-
 
|-
|2:16
+
|02:16
 
|Let's try and echo out my age now.  
 
|Let's try and echo out my age now.  
 
|-
 
|-
|2:19
+
|02:19
 
|It's just an integer variable and that's been echoed out here.  
 
|It's just an integer variable and that's been echoed out here.  
 
|-
 
|-
|2:24
+
|02:24
 
|Okay so, the thing with variables is that they're very easy to concatenate into a string.  
 
|Okay so, the thing with variables is that they're very easy to concatenate into a string.  
 
|-
 
|-
|2:30
+
|02:30
 
|In fact, probably, concatenation is the wrong word – they're very easy to include inside your string.  
 
|In fact, probably, concatenation is the wrong word – they're very easy to include inside your string.  
 
|-
 
|-
|2:37
+
|02:37
 
|If you don't know what concatenation is, it just means to join two things together or to join two strings together in a line.  
 
|If you don't know what concatenation is, it just means to join two things together or to join two strings together in a line.  
 
|-
 
|-
|2:46
+
|02:46
 
|So, an example of concatenation would be, let's see, 'concat' and then I could say, '.' and then 'ination'.  
 
|So, an example of concatenation would be, let's see, 'concat' and then I could say, '.' and then 'ination'.  
 
|-
 
|-
|2:56
+
|02:56
 
|Now, this would echo out 'concatination'.  
 
|Now, this would echo out 'concatination'.  
 
|-
 
|-
|2:59
+
|02:59
 
|Let's try this. Okay?  
 
|Let's try this. Okay?  
 
|-
 
|-
|3:03
+
|03:03
 
|But there is a completely different tutorial on that. So, what I'll say is, for now, you don't need to include this as one of your variables when you're echoing it out.  
 
|But there is a completely different tutorial on that. So, what I'll say is, for now, you don't need to include this as one of your variables when you're echoing it out.  
 
|-
 
|-
|3:14
+
|03:14
 
|If you can't follow this, don't worry.  This is very, very simple.  
 
|If you can't follow this, don't worry.  This is very, very simple.  
 
|-
 
|-
|3:18
+
|03:18
 
|I'll say "My name is" name "and my age is" and put my age down.  
 
|I'll say "My name is" name "and my age is" and put my age down.  
 
|-
 
|-
|3:24
+
|03:24
 
|Now, it's all in one string, all in one echo, and we've just got 'My name is' – plain text.  
 
|Now, it's all in one string, all in one echo, and we've just got 'My name is' – plain text.  
 
|-
 
|-
|3:32
+
|03:32
 
|Variable is called.  This is put here. And then when age is called, the value for age is put here.  
 
|Variable is called.  This is put here. And then when age is called, the value for age is put here.  
 
|-
 
|-
|3:40
+
|03:40
 
|So, we can refresh that and you can see that "My name is Alex".  That's our variable. "and my age is 19" and that's our variable.  
 
|So, we can refresh that and you can see that "My name is Alex".  That's our variable. "and my age is 19" and that's our variable.  
 
|-
 
|-
|3:48
+
|03:48
 
|So they're really easy to put into strings.   
 
|So they're really easy to put into strings.   
 
|-
 
|-
|3:52
+
|03:52
 
|Okay, this is all you really need to know about variables.  
 
|Okay, this is all you really need to know about variables.  
 
|-
 
|-
|3:56
+
|03:56
 
|There are other types of variables, like boolean, decimal – which I've shown you, for example like '19.5'.   
 
|There are other types of variables, like boolean, decimal – which I've shown you, for example like '19.5'.   
 
|-
 
|-
|4:06
+
|04:06
 
|You would declare them in the same way, with a dollar sign.  
 
|You would declare them in the same way, with a dollar sign.  
 
|-
 
|-
|4:10
+
|04:10
 
|So practice this and you can come back and learn some more advanced functionality later on, when I'm going through some other projects.  
 
|So practice this and you can come back and learn some more advanced functionality later on, when I'm going through some other projects.  
 
|-
 
|-
|4:19
+
|04:19
 
|Thanks for watching!  This is Joshua Mathew dubbing for the Spoken Tutorial project. (Script contributed by Bhavini Pant).
 
|Thanks for watching!  This is Joshua Mathew dubbing for the Spoken Tutorial project. (Script contributed by Bhavini Pant).

Revision as of 10:59, 10 July 2014

Time Narration
00:00 Welcome to a basic tutorial on PHP variables.
00:04 Let me quickly go through a few things first.
00:07 PHP variables are very easy to use; I'm sure you'll understand them straight away.
00:14 You don't need to declare them and they're quite easy to write.
00:18 You can add a value to a variable half way through the script.
00:23 Also, they automatically convert to the data type you require.
00:28 So there's no need to declare them in a different way each time, or create a value for them each time.
00:36 So, for example, let's create our PHP tags here and our content goes in between.
00:41 Okay. Now we start with the dollar sign and then we have our variable name.
00:48 Please note that you can't start with a "number". So I can't start with a '1'.
00:53 What I can start with is an "underscore" or a "letter".
00:57 No other special characters are allowed except underscores, letters and numbers, as long as it doesn't start with a number.
01:06 So that would be perfectly acceptable here.
01:09 Okay, so I'll create a variable called "name" and that's going to be equal to a string value contained within double quotes, just like we used for the "echo" function.
01:21 'My name is Alex'.
01:23 On the next line, we're going to create another variable using a dollar sign, called 'age'. That's going to be equal to '19', without double quotes.
01:33 Now the reason for this is that this is an integer.
01:36 You can use it for decimal values as well. So this could be '19.5' or nineteen and a half.
01:43 That would also automatically convert this into a decimal.
01:48 However, at the moment it's just an integer. That's how I want it - the variable 'name' is a string and the variable 'age' is an integer.
01:57 So let's try echoing these out.
02:00 What we need is "echo" and the variable name, not forgetting your line terminator.
02:06 Okay, let's find our file named "variables".
02:11 Okay, "Alex" has been echoed out, just like I've said here, "echo name".
02:16 Let's try and echo out my age now.
02:19 It's just an integer variable and that's been echoed out here.
02:24 Okay so, the thing with variables is that they're very easy to concatenate into a string.
02:30 In fact, probably, concatenation is the wrong word – they're very easy to include inside your string.
02:37 If you don't know what concatenation is, it just means to join two things together or to join two strings together in a line.
02:46 So, an example of concatenation would be, let's see, 'concat' and then I could say, '.' and then 'ination'.
02:56 Now, this would echo out 'concatination'.
02:59 Let's try this. Okay?
03:03 But there is a completely different tutorial on that. So, what I'll say is, for now, you don't need to include this as one of your variables when you're echoing it out.
03:14 If you can't follow this, don't worry. This is very, very simple.
03:18 I'll say "My name is" name "and my age is" and put my age down.
03:24 Now, it's all in one string, all in one echo, and we've just got 'My name is' – plain text.
03:32 Variable is called. This is put here. And then when age is called, the value for age is put here.
03:40 So, we can refresh that and you can see that "My name is Alex". That's our variable. "and my age is 19" and that's our variable.
03:48 So they're really easy to put into strings.
03:52 Okay, this is all you really need to know about variables.
03:56 There are other types of variables, like boolean, decimal – which I've shown you, for example like '19.5'.
04:06 You would declare them in the same way, with a dollar sign.
04:10 So practice this and you can come back and learn some more advanced functionality later on, when I'm going through some other projects.
04:19 Thanks for watching! This is Joshua Mathew dubbing for the Spoken Tutorial project. (Script contributed by Bhavini Pant).

Contributors and Content Editors

Minal, Pratik kamble, Sandhya.np14