1 00:00:00,096 --> 00:00:05,162 [MUSIC] 2 00:00:05,162 --> 00:00:09,832 PHP has tons of built in functions to make your life as a PHP developer so 3 00:00:09,832 --> 00:00:11,210 much better. 4 00:00:11,210 --> 00:00:14,870 But first, we need to know how to find them, and how to read the docs. 5 00:00:14,870 --> 00:00:16,976 So let's jump in. 6 00:00:16,976 --> 00:00:22,050 Okay, so, from Google search I'm just gonna type in PHP built in. 7 00:00:23,300 --> 00:00:26,330 Okay, built in functions, and 8 00:00:26,330 --> 00:00:30,070 our first result should be PHP internal built in functions manual. 9 00:00:30,070 --> 00:00:35,050 So you'll see this is gonna take us to php.net/manual/en for 10 00:00:35,050 --> 00:00:38,310 English, and then functions internal PHP. 11 00:00:38,310 --> 00:00:39,940 If you look at the second paragraph, 12 00:00:39,940 --> 00:00:44,790 there's a section here that says, how to read a functions definition. 13 00:00:44,790 --> 00:00:48,400 So taking a look at this we understand our data types. 14 00:00:48,400 --> 00:00:51,160 We've gone over that in a previous lesson. 15 00:00:51,160 --> 00:00:54,600 So what we're gonna look at is how it is defined. 16 00:00:54,600 --> 00:00:58,910 So for instance, we're looking at string length as our first example. 17 00:00:58,910 --> 00:01:02,620 So what you'll see, is that there is a function name, 18 00:01:02,620 --> 00:01:07,954 then it will show you when it's been around, so it's been in PHP4 and PHP5. 19 00:01:07,954 --> 00:01:13,245 It's going to return an integer value, so you'll see here it says int strlen length, 20 00:01:13,245 --> 00:01:18,080 and then inside of that, it'll show you the argument you pass through. 21 00:01:18,080 --> 00:01:21,445 It starts by showing you what kind of argument it expects. 22 00:01:21,445 --> 00:01:24,800 So it expects a string, and then you pass through a variable, and 23 00:01:24,800 --> 00:01:27,140 in this case it just says, string. 24 00:01:27,140 --> 00:01:30,270 So then, it tells you the result. 25 00:01:30,270 --> 00:01:34,000 It'll say it will return the length of a given string. 26 00:01:34,000 --> 00:01:37,380 So that's a very, very simple way to look at the docs. 27 00:01:37,380 --> 00:01:40,150 Let's look at string length actually defined. 28 00:01:40,150 --> 00:01:42,410 There's actually a link right up here to it. 29 00:01:42,410 --> 00:01:46,160 And then we can see how the docs actually look to us. 30 00:01:46,160 --> 00:01:51,560 So you'll see here under strlen, we see PHP 4, PHP 5, 31 00:01:51,560 --> 00:01:56,120 and then a quick description which just says, get string length. 32 00:01:56,120 --> 00:01:57,910 Then, what it expects. 33 00:01:57,910 --> 00:02:01,480 Int means it expects an integer, then you have the keyword, 34 00:02:01,480 --> 00:02:04,060 which is strlen, which is the actual function. 35 00:02:04,060 --> 00:02:07,842 Then the arguments that you pass through have to be a string, and then you 36 00:02:07,842 --> 00:02:11,947 just pass through a single argument that is required, dollar sign, string. 37 00:02:11,947 --> 00:02:16,700 It'll return to you, the length of the given string as an integer. 38 00:02:16,700 --> 00:02:21,380 So that's a very basic example of how to read the documentation. 39 00:02:21,380 --> 00:02:25,750 Now, we're gonna do some more, starting with how to look at string functions.