Join Kevin Skoglund for an in-depth discussion in this video Challenge: Convert to and from metric volume, part of Easy PHP Projects: Measurement Conversion.
- Now that we have our volume measurement…conversion form in place,…we're ready to write the code…that will actually perform the volume conversions.…First, we need to decide what common unit we're going to use…in order to move between the different units.…When we're working with length, we use meters,…when we're working with area, we use square meters.…You might think then that the next choice…would be cubic meters,…and we could, but I would argue that a better choice…would actually be liters.…Liters is also a metric standard unit,…just like cubic meters is,…but most of the volume units that we have in our list…are for liquid capacities,…and some of them are for very small capacities,…like tablespoons and teaspoons.…
I think that we're going to get more use…out of using liters,…which is a smaller metric unit than meters,…which is also used primarily for liquids.…Even when you have things like buildings,…we don't typically talk about…the cubic meters in a building,…we talk about the area or the square footage.…In some uses, you might still talk about cubic meters…
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
Accessing Databases with Object-Oriented PHPwith 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?
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.