- preg_match: documentation ( source)
<?php
$b= 1234;
$your_variable = '<input name="LFMIdsite" value="8635" type="hidden">';
$result = preg_match('/name="LFMIdsite" value="(.*?)"/', $your_variable, $matches);
$lidsite = $matches[1];
echo $lidsite;