- preg_match: documentation ( source)
- trim: documentation ( source)
<?php
$attr = '@C_1_2=Client';
$d = 'C_1_2: Client';
if (preg_match('/\@(.*)=(.*)/', $attr, $matches)) {
// check corresponding values
$tmp_attr = trim($matches[1]);
$tmp_value = trim($matches[2]);
if (preg_match("/$tmp_attr:$tmp_value/", $d)) {
echo 'yes';
}
}