How can PHP functions like substr() and strpos() be utilized to manipulate text data in SQL queries?

When manipulating text data in SQL queries using PHP, functions like substr() and strpos() can be used to extract specific parts of a string or find the position of a substring. These functions can be helpful when you need to manipulate text data before passing it to a SQL query, such as extracting a specific part of a string to use in a WHERE clause.

// Example of using substr() and strpos() to manipulate text data in an SQL query
$text = "Hello, World!";
$substring = substr($text, 0, strpos($text, ","));
$sql = "SELECT * FROM table WHERE column LIKE '%" . $substring . "%'";
// Execute the SQL query using the $sql variable