Replace any text from html text by tag name with specific attribute in php

function replace_tag_with_specific_attr_type( $tagAttribute, $tagAttributeValue, $subjectStr, $tagName=null,$replaceStr ) { if( is_null($tagName) ) $tagName = ‘\w+'; else $tagName = preg_quote($tagName); $tagAttribute = preg_quote($tagAttribute); $tagAttributeValue = preg_quote($tagAttributeValue); $match_regex = “/<(“.$tagName.”)[^>]*$tagAttribute\s*=\s*”. “([‘\”])$tagAttributeValue\\2[^>]*>(.*?)<\/\\1>/”; preg_match_all($match_regex, $subjectStr, $matches, PREG_PATTERN_ORDER); $result = str_replace($matches[3],$replaceStr,$subjectStr); return $result; } Usage :

Replace any text from html text by tag name in php

function replace_tag_text($tagName,$subjectStr,$replaceStr) { $tagName = preg_quote($tagName); preg_match_all(‘{<‘.$tagName.'[^>]*>(.*?)</’.$tagName.’>}’,$subjectStr,$matches,PREG_PATTERN_ORDER); $result = str_replace($matches[1],$replaceStr,$subjectStr); return $result; } Usage : Say for Example $ActualStr : ‘<div><span style=”margin: 0px 0px 0px 0px; width: 540px;”>something</span><p style=”float: right; margin: -240px 0 0; width: 200px;”>This is the actual String</p></div>';

integrate window media player in your website

<html> <head></head> <body leftmargin=”0″ topmargin=”0″> <table cellpadding=”0″ cellspacing=”0″ border=”0″> <tr height=”350″><td align=”center”> <table cellpadding=”0″ cellspacing=”0″ border=1 bordercolor=”black”> <tr> <td valign=”top”> <OBJECT ID=”MediaPlayer” WIDTH=”320″ HEIGHT=”290″ CLASSID=”CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95″ STANDBY=”Loading Windows Media Player components…” TYPE=”application/x-oleobject”> <PARAM NAME=”URL” VALUE=’http://localhost/vinod/meeting_with_the_boss.wmv’ /> <param name=”AudioStream” value=”0″ /> <param