Join Kevin Skoglund for an in-depth discussion in this video Challenge: Convert to and from metric mass, part of Easy PHP Projects: Measurement Conversion.
- Now that we have our mass conversion form all set up,…we're ready to do the code that actually…does the conversion for us.…We've already said that the common unit…of measurement we're going to use is the kilogram,…so all we need is the conversion constant…to get from each unit into kilograms.…We have a chart here, and you can see it has…ounce, pound, stone, long ton and short ton,…and the conversion numbers we need to get to kilograms.…I want to make a few other notes on these units, though.…Ounce here is a unit of mass.…We also saw it used as a unit…of volume measurement earlier.…The volume version is sometimes called fluid ounce,…in order to avoid confusion.…
In this case, they're on separate pages, clearly marked…as being volume and mass, so I think it's OK.…If you want, you can change it into fluid ounce…in order to avoid confusion.…Pound is probably the most commonly used…of the Imperial and US measures,…the one that you're most familiar with,…then there's stone, which is still used in some places…but also considered a bit old-fashioned.…
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?
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.