Introducing the Practice2:35 with Alena Holligan
Let's practice some PHP to solidify your growing knowledge and make it stick.
It's okay to make multiple attempts before coming to a solution. That struggle to remember what you've learned , and apply it to the situation, is what causes the knowledge to take root.
Course: PHP Basics (Stage 3) Daily Exercise Program
[MUSIC] 0:00 Hey everyone, Alena here. 0:04 Practice is vital to becoming a proficient developer. 0:07 It solidifies what you've learned causing it to stick in your memory. 0:10 With deliberate practice, it becomes quicker and 0:14 easier to solve the challenges you'll face everyday. 0:17 So let's practice some PHP. 0:20 This practice session is intended to follow the third stage 0:23 of the PHP basics course. 0:26 If you haven't taken that course already, or find this practice session 0:28 too difficult, then review stage three of the PHP basics course. 0:32 Check the notes associated with this video for additional links and resources. 0:37 Let's review the challenge. 0:43 I've included some initial variables at the start of the index.php file. 0:45 There are six steps to completing this challenge. 0:51 The file includes a comment for each step. 0:54 Add your code below each comment. 0:57 Step one, create a variable named myLines and 1:00 set its value equal to the integer 40000000. 1:04 4 followed by six 0s. 1:08 Step two, use an if statement to check whether myLines is greater than $osx. 1:11 If so, display the string. 1:18 Step three, add an else if statement to check whether myLines 1:22 is greater than $android, and if so, display the string. 1:26 Step four, add another else if statement to check whether myLines is 1:32 greater than $apollo11, and if so, display the string. 1:37 Step five, add a final else statement to display the string. 1:43 And finally step six, test your code by changing the value of myLines 1:48 until you have reached all possibilities. 1:53 At any point, to test out what you've done, go to View > Show Console. 1:56 And type php index.php. 2:03 There are no errors and nothing is displayed to the screen. 2:06 Remember, it's okay to make multiple attempts before coming to a solution. 2:12 That struggle to remember what you've learned and 2:17 apply it to the situation is what causes the knowledge to take root. 2:19 If you do get stuck, 2:24 I've included additional resources in the notes associated with this video. 2:25 Go ahead and give it a try, and I'll show you my solution in the next video. 2:30
You need to sign up for Treehouse in order to download course files.Sign up