Are there any best practices or guidelines for optimizing PHP code performance when dealing with multiple function calls and conditional statements?

When dealing with multiple function calls and conditional statements in PHP, it is important to optimize the code for better performance. One way to do this is by minimizing the number of function calls and reducing the complexity of conditional statements. This can be achieved by using caching mechanisms, avoiding unnecessary function calls, and optimizing the logic flow.

// Example of optimizing PHP code performance with multiple function calls and conditional statements

// Bad practice
if (condition1) {
    $result = expensiveFunction();
} elseif (condition2) {
    $result = anotherExpensiveFunction();
} else {
    $result = defaultFunction();
}

// Good practice
$result = defaultFunction();
if (condition1) {
    $result = expensiveFunction();
} elseif (condition2) {
    $result = anotherExpensiveFunction();
}