Join Kevin Skoglund for an in-depth discussion in this video Format scientific notation, part of Easy PHP Projects: Measurement Conversion.
- In this movie, we will learn what scientific notation is,…and how to format it with PHP…In our code, when we try to convert one milligram of mass…into kilograms, PHP returns an odd answer to us.…It tells us that the conversion is equal to 1.0E-6.…That is a correct answer, but it's not in a very friendly…notation, and it might not mean anything…to the average user.…We'd much rather see something we're familiar with,…like 0.000001 kilograms.…
That makes sense to us.…So what does this other notation, and what does it mean?…It's called scientific notation.…Scientific notation is a format for numbers,…which are either too big or too small to be written…in decimal form conveniently.…And the idea of conveniently is a little bit…open for interpretation.…PHP decided that that number was small enough…that it warranted using scientific notation.…So for example, you might have 2.45E-12 instead of having…0. and a whole lot of zeroes, followed by 245.…
It's a much shorter, more concise way of…writing out the number.…The way that you calculate it,…
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.