Righto - so I wanted to clear a few things up after the lesson. Firstly, heres how my current lesson timing runs (it's based on my local time with AEST (gmt+1100)). Monday evening I'll post the lesson for that week. Tuesday evening (now) I'll post the actual homework for that week. That gives roughly 24 hours to let me know if you have got any questions or issues with the lesson. In the lessons I'll cover the basics of what you need to know ( e.g. data types).
Home work is designed to not only "teach" you how to do things, but where to find the information if you're not able to post on forums, or on IRC etc. Often it'll be finding the exception to a rule, or listing more options (other unused options etc) than what I've explained. Although you should be able to know PHP fairly well without completeing the homework, I really recommend you do it because it will help your understanding, and it will be that little thing that makes things click in your brain.
________________________________________________________
So - To lesson 1's homework.
In the lesson yesterday, I covered the basics of data, and variables. Below are 10 questions to get you understanding the specifics of strings, and other data types.
1) List 4 different ways to create and/or display a string.
2) What is the output from the following code? Suggest an example where it might be useful to use that method.
CODE
<?php
$variable = "Hello!";
$name ="variable";
echo $$name;
?>
$variable = "Hello!";
$name ="variable";
echo $$name;
?>
3) What does the following code do/display, and why it might be useful? (This is a very important feature of PHP).
CODE
<?php
$foo = 3.14159;
echo "4 cows" + $foo;
?>
$foo = 3.14159;
echo "4 cows" + $foo;
?>
4) Create 2 variables, and find a way to join them together to make one string, save it in a variable and then display it all in uppercase. (hint: look into using PHP functions, though we haven't covered function use so its a "bonus mark").
5) Why doesn't the following code work, and how can I fix it?
CODE
<?php
echo "\\"; //Hint, I want the output to be 2 backslashes one after the other
?>
echo "\\"; //Hint, I want the output to be 2 backslashes one after the other
?>
6) Explain what the following data type is, and how I can make it a number (integer).
CODE
<?php
echo 0x1B;
?>
echo 0x1B;
?>
7) Why doesn't the following code round the number as expected?
CODE
<?php
echo (int) 4.9; // Expected output is "5"
?>
echo (int) 4.9; // Expected output is "5"
?>
8) What do the following data definitions have in common? Note that if you type this into a PHP page, it will cause an error ( its not 100% correct code).
CODE
<?php
"string"
1
true
-1
?>
"string"
1
true
-1
?>
9) What is a NULL value and when/why is it used?
10) Is this homework too hard, and did you want it to be easier
That's it. For now, I'll suggest that you look around on the PHP website, in the documentation pages....
As I mentioned above, I'm not at all expecting you to complete all the homework, nor am I going to ignore it. If you do want to do it or some of it, I'll go through it and "mark" it, and help each of you individually in explaining the answers to anything you couldn't find etc. If anyone feels protective of their code etc (i.e., you don't want to post a copy of your work on the forum) you can email me the code when its complete etc. Please post on the forum when you have emailed me the homework so I can make sure it doesn't go to spam etc. Because of the above reason for homework, I'm not setting a due date as such, but I reccomend you look at it if you are going to, before the next lesson (because just like maths, each lesson will build on the previous). jack@battleages.com is my email - so pretty much do it, send it, ill get back to you and we can get working !!! Just a note though, if you could send the answers as the email body and not as an attachemt (.doc .pdf etc) then that would help a lot. It's easiest for me because I can reply back with "edits" to the code immediately without having to download, open, edit, save etc
As always, I'm available on msn or through email - but please post here if you have any questions regarding the homework.
Thanks and happy researching,
Jack
This post has been edited by Jack: 03 February 2009 - 08:46 PM

Sign In
Register
Help


MultiQuote