Bird
0
0

Given the .env file contains APP_DEBUG=false, what will env('APP_DEBUG', true) return in Laravel?

medium📝 state output Q4 of 15
Laravel - Configuration and Environment
Given the .env file contains APP_DEBUG=false, what will env('APP_DEBUG', true) return in Laravel?
Aerror
Btrue
Cnull
Dfalse
Step-by-Step Solution
Solution:
  1. Step 1: Understand env() default value behavior

    If the variable exists in .env, env() returns its value, ignoring the default.
  2. Step 2: Check the .env value for APP_DEBUG

    APP_DEBUG is set to false, so env('APP_DEBUG', true) returns false.
  3. Final Answer:

    false -> Option D
  4. Quick Check:

    env() returns .env value over default [OK]
Quick Trick: env() returns .env value, default used only if missing [OK]
Common Mistakes:
  • Assuming default value always returns
  • Confusing string 'false' with boolean false
  • Expecting error if variable is false

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Laravel Quizzes