PHP - Variables and Data TypesWhat is the output of the following PHP code?$num = 08; echo $num;AParse error due to invalid octal numberB8C0DNULLCheck Answer
Step-by-Step SolutionSolution:Step 1: Understand PHP integer literalsIn PHP, numbers starting with 0 are interpreted as octal (base 8).Step 2: Check the given numberThe number 08 is invalid in octal because 8 is not a valid octal digit (digits must be 0-7).Step 3: ResultPHP throws a parse error when encountering invalid octal literals like 08.Final Answer:Parse error due to invalid octal number -> Option AQuick Check:Leading zero means octal; 8 is invalid digit [OK]Quick Trick: Numbers starting with 0 are octal; 8 is invalid digit [OK]Common Mistakes:Assuming 08 is a decimal numberExpecting output '8' without errorConfusing octal and decimal literals
Master "Variables and Data Types" in PHP9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepVisualTryChallengeProjectRecallTime
More PHP Quizzes Arrays - Array merge and combine - Quiz 5medium Arrays - Array search functions - Quiz 6medium Conditional Statements - If-else execution flow - Quiz 8hard Conditional Statements - Null coalescing in conditions - Quiz 3easy Functions - Global keyword behavior - Quiz 5medium Operators - Assignment and compound assignment - Quiz 11easy Operators - Spaceship operator - Quiz 5medium Operators - Null coalescing operator - Quiz 11easy Type Handling - Gettype and typeof checks - Quiz 14medium Type Handling - Why type awareness matters - Quiz 13medium