What is the significance of using square brackets in regular expressions in PHP?

Square brackets in regular expressions in PHP are used to specify a set of characters that can match a single character in the input string. This allows for more flexible pattern matching, as you can specify a range of characters or specific characters that you want to match. When using square brackets, the regular expression engine will match any one of the characters inside the brackets. Example:

// Match any digit from 0 to 9
$pattern = '/[0-9]/';

$input = 'abc123def';

if (preg_match($pattern, $input)) {
    echo 'Match found!';
} else {
    echo 'No match found.';
}