What is the concept of greediness in regular expressions and how does it apply to PHP?
Greediness in regular expressions refers to the behavior where the regex engine tries to match as much of the input as possible. This can lead to unexpected results when trying to extract specific patterns from a string. In PHP, you can make a quantifier non-greedy by adding a "?" after it. This tells the regex engine to match as little as possible.
```php
// Example of using non-greedy quantifier in PHP
$string = "I want to extract <b>bold</b> and <i>italic</i> text";
preg_match('/<.*?>/', $string, $matches);
print_r($matches);
```
In this code snippet, the regex pattern `/<.*?>/` uses a non-greedy quantifier `*?` to match the shortest possible string between "<" and ">". This will output an array containing "<b>" as the match instead of "<b>bold</b>".