PHP Code Snippet to replace last instance of a string
Posted on September 6th, 2010 @ 2:47 pm
I haven’t posted any code to this site before, but this one is so useful and short that I figured I’d make an exception.
Here’s a PHP function to replace the last instance of a substring in another string:
function str_replace_last($search, $replace, $subject) {
return strrev(preg_replace('/'.strrev($search).'/', strrev($replace), strrev($subject),1));
}
That’s it!
Tags: geeky, php, programming
Back to the Future 4!
Posted on September 6th, 2010 @ 9:32 am
Looks like George Lucas is going to be working with Robert Zemeckis on a fourth installment in the Back to the Future movie franchise.
Just kidding.
Tags: back to the future, delorean, ewok, geeky, george lucas, robert zemeckis, star wars


