Join Kevin Skoglund for an in-depth discussion in this video Convert from metric length, part of Easy PHP Projects: Measurement Conversion.
- We have learned how to convert any unit into meters.…Now, we're ready to learn how to perform the reverse…operation, converting meters into any length unit.…As an example, let's look at how we…go about converting meters into feet.…We've already seen that 1 foot is equal to 0.3048 meters.…And the formula that we use for converting 3 feet into…meters is to multiply that number of feet by our number,…0.3048, and that gives us the number of meters.…
In order to convert from meters to feet,…it's the reverse operation.…And that means division.…We take the number of meters that we have.…We divide it by 0.3048, and that…tells us how many feet we have.…It's that easy.…It's just division instead of multiplication.…Let's write a convert from meters function in PHP.…So the best way to write our convert from meters function…and save ourselves a lot of typing is to copy…this function that we already wrote for convert to meters,…and then just paste it down here.…
I'm actually going to scroll up to the top here.…TextMate gives me the ability to fold these up,…
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.