Monday 11 January 2016

Search and replace string in PHP

Search and replace string in php.
Search and replacing string is not difficult using the function str_replace();
I have to search a string (actually an html content which i extracted from a file using file_get_content()), string to was src=" and replace with src="http://path/to/the/image/folder/ and i acheived this by simply str_replace('src="','src="http://path/to/the/image/folder/',$str);

Follow me on twitter: http://www.twitter.com/_josiah_king Join me on Google+: https://www.plus.google.com/u/0/113541005774136102412/posts/p/pub?cfem=1

No comments:

Post a Comment