Are there any potential pitfalls or limitations when using the ternary operator in PHP?

One potential pitfall when using the ternary operator in PHP is that it can lead to less readable code when nested too deeply or used excessively. To mitigate this, it's important to use the ternary operator judiciously and consider breaking complex conditions into separate lines for better readability.

// Example of using the ternary operator with complex conditions
$result = ($condition1) ? ($condition2 ? 'true' : 'false') : 'false';

// Improved version with separate lines for better readability
$result = ($condition1) ? 
            ($condition2 ? 'true' : 'false') 
            : 'false';