- var_dump: documentation ( source)
- preg_match_all: documentation ( source)
- preg_quote: documentation ( source)
<?php
$text = <<<TXT
/some text/
TXT;
$pattern = "/";
$pattern = preg_quote($pattern);
$matches = array();
$match = preg_match_all("/" . $pattern . "/gmi", $text, $matches);
var_dump($match, $matches);