Highlight String in PHP
Function for highlighting text/strings in PHP.
$content = file_get_contents("http://php.net/");
print highlight("PHP", $content);
function highlight($match, $string){
return str_ireplace($match, "<span style='background:yellow'>$match</span&...
Written by Sean Behan on 06/17/2012
Absolutize Relative Links Using PHP and Preg_Replace_Callback
I was in the market for a simple php script to replace hrefs with their absolute paths from scraped web pages. I wrote one myself. I used the preg_replace_callback function so that I could pass the parsed results as a single variable.
<?php
$domain =...
Written by Sean Behan on 06/17/2012