معمولا از این فانکشن ها استفاده می کنند :


function before($this, $inthat) {

return substr($inthat, 0, strpos($inthat, $this));
}
function after($this, $inthat) {
if(!is_bool(strpos($inthat, $this))) {
return substr($inthat, strpos($inthat,$this)+strlen($this));
}else{
return false;
}
}


function vasat ($this, $that, $inthat) {
return before($that, after($this, $inthat));
}


$code = '<BlogPostBlock id=5>';
$id = vasat ('<BlogPostBlock id=' , '>',$code);
echo $id; // = 5 ! :)