3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = 'fix me <a href="www.link.com">link</a> or fix me <a href="link.com">link</a> and fix me too <a href="http://link.com">link</a> and replace me with <a href="http://www.link.com>link</a>'; echo str_replace('www.www', 'www', str_replace('http://www.http://', 'http://www.', str_replace('a href="', 'a href="http://www.', $str)));

preferences:
38.36 ms | 402 KiB | 5 Q