Join Kevin Skoglund for an in-depth discussion in this video Solution: Convert to and from metric mass, part of Easy PHP Projects: Measurement Conversion.
(chimes)…- In the previous movie, I asked you to try installing…the code for mass conversion on your own,…using the work that we've done…in previous chapters as a guide.…Here's my version.…I'd already helped you get started by defining…that constant for mass to kilogram,…so you should have that and all of those values…that we need for conversions already installed…at the top of this Functions file.…Then what's needed is to go in and update.…Convert mass, convert to kilograms,…and convert from kilograms.…Let's start with convert mass first.…
So, convert mass is going to call…convert to kilograms and convert from kilograms,…and I also went ahead and just changed…the name of this variable from liter value…or meter value to be kg value.…That's the abbreviation for kilogram.…So then I'm using kg value in both cases there,…but everything else is pretty much the same.…Convert to kilograms and convert from kilograms…just require us to update the name of that variable.…Where can it find the array that it needs…to pull values from?…
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.