Now I'm at a place that has VERY loosely managed code where they virtually cannot upgrade some sites without a rewrite. They're on an old version of PHP 5.2 and MySQL 5.0. I'm doing all I can to get everyone there to understand the issues with legacy software, but it's a tough battle. Thankfully, I've got new code and features running the latest PHP and MySQL versions, it'll be several (many) years until all of it's managed enough to be upgradable.
I can also say I've always thought the PHP complaints were unfounded -- no real company doesn't understand OOP, datatypes, etc. Yeah... I completely understand now. It's a fun challenge putting good, solid standards in place and moving a horrid codebase into a great one, though.