What are some common methods to search for specific values within a string in PHP?

When searching for specific values within a string in PHP, some common methods include using functions like strpos(), strstr(), preg_match(), and substr(). These functions allow you to search for a specific substring or pattern within a string and return the position or occurrence of the value.

// Using strpos() to search for a specific substring within a string
$string = "Hello, world!";
$substring = "world";
$position = strpos($string, $substring);

if ($position !== false) {
    echo "Found '$substring' at position $position";
} else {
    echo "Substring not found";
}