To-do list - PHP Sample
Task 1 - outsource recurring elements
When creating the PHP project to-do list, it is important to ensure that the business logic and data storage components are properly structured and separated. This separation makes the program easier to understand and helps to avoid errors.
Create the required PHP pages and store recurring elements in a file each and then integrate the files in the appropriate places.
Task 2 - Arrays
Arrays are one of the compound data types in PHP. They are used to store more than one value in a variable. These values can be of any PHP data type.
a) Create arrays for three pages and fill them with the appropriate content from the individual pages (e.g. tasks (Aufgaben), members(Personen), todos). To do this, think about a suitable structure for the array.
Help with using arrays:
An array is an ordered list of variables. For example a list of numbers or a list of texts (strings). We can use an array to summarize the days of the week in a list, or all members of our todo list. For some purposes it even makes sense to use multi-dimensional arrays.
b) If you access non-existent variables (arrays), this leads to errors. Therefore, check whether the corresponding array and its values are already set.
c) Iterate through all the elements of the arrays and output them. In this way you can rebuild the original structure of the page.