Try the following
When you feel that you know php and you like to practice a bit of programming, you will find few useful list of tasks here.
To do the following tasks you should know :
php, html forms, passing post and get variables to the same php page or to a different php page. You should also know how to receiving those php variables.
Work out the tasks
In the end of the page find my email for you to send your zip file to me to check your code and we can discuss more. I can direct you through the right path if I find some mistakes in your code. Feel free to do as many mistakes as you can, You will learn from it. Please do not send your files with known errors ! Make comments where ever necessary so that I can understand your code better. It would be much better if
During practising these tasks I am sure you will learn a lot of inbuilt php functions that you would not have thought of.
Tasks set 1: The complexity increases as you go down the numbers
1. Find the biggest among 5 and 7
- You can get inputs from a form and display the result in the same page and next page - please try displaying in same page and next page. extend to display biggest among three given number extent to display the smallest among the three numbers too HINTS: Remember you need to code only at your display for the extended tasks Use arithmetic, comparison operators and few conditional operators.
2. Find if the given year in a leap year or not
- get input from user through a form validate it to be a year. - display the result if the given year is a leap year or not.
3. Display a loop
- get start and end year from the user and display from lowest year to the highest. eg: if start : 1920 and end : 1930 the display would be from 1920..1921 so on till 1930 - extend this task and try in all different loops(for, while, do-while,) that you learned in your tutorials.
4. Display the following – conditions
- if today is monday and tuesday and wednesday - display “we are going to school” - if today is monday - display ”we will be learning mathematics” - if today is tuesday or wednesday - display “we will be learning physics” - if today is thursday or friday - display “We will be on a practical class” - if today is saturday or sunday - display “We are on a holiday” HINT : for monday remember you will have to display both the following : “we will be going to school, we will be learning mathematics” - use logical operators along with string concat and few other previously used and needed operators too.
5. Find the age
- Get date of birth from the user and find how many years he is old now. - extend this to narrow down to how many years, months, weeks, days old he is. eg: You should display something like “You are 16 years 4 months and 3 days old"
Hope I have triggered your thoughts a bit, more set of tasks to be listed here soon and you can improve your programming skills with it.
By now you should have come across many useful php functions, you should be knowing all operators(arithmetic, logical, comparison, … ) and loops (for, while and do-while). Please comment back how you found this task list so that I can post more complex tasks for you to try, Thanks.
Please email your codes for evaluation to
email@example.com, compress and send files in zip format.