- var_dump: documentation ( source)
- preg_match: documentation ( source)
<?php
var_dump(preg_match('#<(link)(\s[^>]*|)>#i', '<link>'));
var_dump(preg_match('#<(link)(\s[^>]*|)>#i', '<link/>'));
var_dump(preg_match('#<(link)(\s[^>]*|)>#i', '<link rel=test>'));
var_dump(preg_match('#<(link)(\s[^>]*)?>#i', '<link>'));
var_dump(preg_match('#<(link)(\s[^>]*)?>#i', '<link/>'));
var_dump(preg_match('#<(link)(\s[^>]*)?>#i', '<link rel=test>'));