Beginner
PHP
Q24 / 100
How do you convert a string to an integer in PHP?
Correct! Well done.
Incorrect.
The correct answer is A) intval($str) or (int)$str
A
Correct Answer
intval($str) or (int)$str
Explanation
intval("42") or (int)"42" both return 42. intval() allows specifying a base (e.g., intval("0xFF", 16)).
Progress
24/100