Join Kevin Skoglund for an in-depth discussion in this video Convert between any length units, part of Easy PHP Projects: Measurement Conversion.
We can now convert anything into metric length.…And we convert anything from metric length.…That means that we can use our metric unit as a common value…to get from any one unit to any other unit…by passing through meters.…For example, we can convert inches into millimeters,…by first converting inches into meters,…and then meters into millimeters.…Let's see how we can do that in our PHP code.…In the last movie, we commented out…our convert to meters function…so that we could try out our convert from meters function.…
What we want now is for these two to play happily together.…And the way that we do that, is that we need to change this…from being a to value to being an intermediary value,…call it meter value.…And then meter value is what gets passed in,…here, to convert from meters.…See how that works?…So we have, whatever value gets submitted,…that's the from value, and the from unit,…we convert that to meters, and we store that…temporarily in this variable, meter value.…And then, we take that meter value,…and we convert it from meters into…
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.