I don't think there is a PHP script that will do this for you. At least I've never come across any. There is an alternative where you can let Apache rewrite the old URLs to the new one, but this will hog a lot of resources, and make you a lose a little bit of link juice every time; overall just not a really good idea.
So indeed what's left is to rewrite all URLs yourself. Maybe you could get your editor to find and replace using regular expressions to make it easier? I know for example NetBeans has this option; you could even do it across several files at once.
It's a bit awkward to do when you first worked with the dynamic URLs, and then change them to "pretty" ones. For future projects, it's better to start using the "pretty" URLs from the get go. Or use a URL manager in PHP itself, like the big frameworks have; they just redirect every request to one php file, and let that file figure out what to do, based on how the URLs are configured in PHP. There are also functions to create URLs based on the same configuration, which makes it very easy to change URLs; just change the configuration and the functions will return the new URLs, and they will work too. Add some 301 redirect if necessary, and you're done.