I am using Simple HTML DOM Parser and with this I am able to get all input tags from object snippet is below
foreach ($InputObj->find('input') as $e) {
$inputTag = $e->outertext;
// now I want to check if input element have size attribute then remove it with preg_replace
$inputTagsSizeStrip = preg_replace('~\<input[^\s]*size=\'|\"[^\'|\"]~is', "" , $inputTag);
}
but no success….
any help will be appriciated…
There is no reason to use regular expressions here. You already have the DOM, just do the necessary manipulation: