Join Kevin Skoglund for an in-depth discussion in this video Solution: Convert to and from metric area, part of Easy PHP Projects: Measurement Conversion.
- At the end of the last movie,…I presented a challenge to you,…to write the area conversions yourself using our code…for length conversions and what we also learned…about how area measurements work.…Hopefully you were able to get it to work on your own.…I'm now going to show you my solution…so you can compare your results with mine.…The first thing I did was I changed…our convert length function to be convert area,…both when we define it and when we call it.…The arguments that we pass in…are still going to be the same.…Then inside convert area I changed the name…of the two functions we're calling from convert to meters…and convert from meters, to become convert to square meters…and convert from square meters.…
Then, I changed the names of the functions up here…where we define them as well.…Next, I dove into each of these functions…and made some edits.…In convert to square meters, where we were looking for…the value of from unit in each of our cases,…it's no longer going to be inches,…instead now it's going to be square_inches.…
Along the way, series designer Kevin Skoglund introduces coding strategies, refactoring techniques, and useful skills including dynamically generating form select-option values and formatting decimal numbers and scientific notation.
- Converting length and area measurements
- Using functions to avoid repetition
- Refactoring to produce simpler code
- Converting volume and mass
- Generating form select-option values dynamically
- Formatting scientific notation
- Converting speed and temperature
Skill Level Beginner
PHP: Accessing Databases with PDO and MySQLiwith David Powers3h 47m Intermediate
1. Length and Distance
3. Volume and Capacity
4. Mass and Weight
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.