87c0bbfb687cd064936f4a029e5e8650 htmlphp lab2 v2 rasb14 2017-09-08 17:32:44 v2.3.3 (2017-06-12)
Generated 2017-09-08 19:32:45 by dbwebb lab-utility v2.3.3 (2017-06-12).
If you need to peek at examples or just want to know more, take a look at the PHP manual.
Here you will find everything this lab will go through and much more.
The foundation for strings.
Create a variable called wordOne and assign the word "earth" to it.
Create another variable called wordTwo and assign the word "kitten" to it.
Concatenate the two strings, and separate them by a hyphen -, into a new variable called result.
Answer with the result-variable.
Create a variable, floatNumber, and assign the value 56.86. Concatenate your variable wordOne with your variable floatNumber, separate the words with a =. Answer with the result.
Create a variable, intNumber, and assign the value 182. Concatenate your variable intNumber with your variable wordTwo, separate the words with a space. Answer with the result.
Create the string: "There are 182 kitten's doing some earth." by combining pure text with the values of your variables wordOne, wordTwo and intNumber. Store the resulting text in a variable sentence. Answer with the variable.
Use strlen() to find the length of the variable sentence. Answer with the result.
Use substr() to find the character at index 3 in the word "foot". Answer with the result.
Use substr() to find the two characters at index 3 and 4 in the word "crocodile". Answer with the result.
Use strpos() to find the first matching index of the character o in the word "monkey". Answer with the result.
Use strpos() to find the first matching, (if any), index of the characters xyz in the word "monkey". Answer with the result.
Store the boolean result of the test: 273 is less than 19 in a variable. Answer with the variable.
Answer with the boolean value of: 204 is larger than 321.
Sum up the numbers: 8, 10, 2, 9 and 2. Save the result in a variable called totalSum.
Create an if/elseif-statement to see if totalSum is higher, lower or equal to 31.
Answer with the corresponding result as a string: "higher", "lower", "equal".
Create an if-statement that checks if a value is between (or equal to) 22 and 38. Use the variable totalSum from last exercise to test the if-statement. Answer with a boolean true if the value is between the values, otherwise respond with false.
For-loops and while-loops.
Create a while-loop that adds 4 to the number 64, 80 times. Use variables to store the numbers. Answer with the result.
Create a while-loop that subtracts 6.25 from the number 689 until the number is between (not equal to) 29 and 39. Answer with the final result as a float, rounded to 2 decimals.
Create a for-loop that iterates from 0 to (including) 18. Add the integer value for each iteration to a string and separate each item with a , (comma). Answer with the final string without an ending ,.
These questions are worth 3 points each. Solve them for extra points.
Create a for-loop that goes through (and including) the numbers 29 to 39. If the current number is even, you should multiply it with PI and add it to a variable res. If the current number is odd, you should subtract the square root of it, from the variable res. If the current number ends with a zero, then ignore it. Answer with the final result of res and round it to the nearest higher integer value.
87c0bbfb687cd064936f4a029e5e8650