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
High-res glossy PHP logo
Posted on May 13th, 2010 @ 10:06 pm
I’ve never been a big fan of the official PHP logo. I was working on a blog post for our T&S blog and had a need for a version of the PHP logo that was recognizable, but tweaked just enough to look better. I decided to go with a look similar to the Dreamweaver 8 logo.

Anyway, here’s the resulting glossy PHP logo. If you like it, feel free to use it. It was made entirely without anyone’s permission. Click it for a bigger version.


