What are potential pitfalls of using nested ternary operators in PHP code?

Using nested ternary operators in PHP code can make the code difficult to read and maintain, as it can lead to complex and confusing logic. It can also make debugging more challenging. To solve this issue, it's recommended to refactor the nested ternary operators into more readable and understandable code using if-else statements or switch-case statements.

// Example of refactoring nested ternary operators into if-else statements
if ($condition1) {
    $result = $value1;
} elseif ($condition2) {
    $result = $value2;
} else {
    $result = $value3;
}