How can parentheses be used in SQL queries within PHP to control the order of evaluation and ensure accurate search results?

Using parentheses in SQL queries within PHP can help control the order of evaluation and ensure accurate search results, especially when combining multiple conditions with AND and OR operators. By enclosing related conditions within parentheses, you can specify the order in which they should be evaluated, preventing unexpected results due to operator precedence. This is particularly important when dealing with complex queries involving nested conditions. Example PHP code snippet:

$query = "SELECT * FROM table_name WHERE (condition1 OR condition2) AND condition3";