If the name part is always going to be 'name="def"' and it's always going to come before the value part, this should work:
$def_pos = strpos($str, 'name="def"');
$value_pos = strpos($str, 'value=', $def_pos);
$value_start = strpos($str, '"', $value_pos);
$value_end = strpos($str, '"', $value_start + 1);
$len = $value_end - $value_start + 1;
$value = trim(substr($str, $value_start, $len), '" ');
You'll have to put in your own error-checking, and maybe a "strtolower()" or two.