What is type juggling in PHP?

Beginner

Answer

Type juggling is PHP's automatic conversion of data types based on context. While convenient, it can cause unexpected results.

$str = "10";
$num = 5;
echo $str + $num; // 15 (string converted to integer)

Use strict comparison (===) and type declarations to avoid issues.