Question: Assume that `$r` is 255, and `$g` and `$b` are both 0. What is the correct code to output `"#ff0000"`?

  1. `printf('#%2x%2x%2x', 255, 0, 0);`
  2. `printf('#%2X%2X%2X', $r, 0, 0);`
  3. `printf('#%x%x%x', 255, 0, 0);`
  4. `printf('#%02x%02x%02x', 255, 0, 0);`

Answer: The correct answer of the above question is Option D:`printf('#%02x%02x%02x', 255, 0, 0);`