3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $targets = array('\\','/',':','*','?','"','<','>','|','-'); $replace = '_'; $samples = array( 'c:\Windows\win.com', '/chat/stackoverflow/com/rooms/11.php', 'I like goats' ); print '<table>'; $results = array(); foreach ($samples as $s) { print '<tr><td>'.$s.'</td><td>'.str_replace($targets, $replace, $s).'</td><tr>'; } print '</table>';
Output for 4.3.0 - 7.1.0
<table><tr><td>c:\Windows\win.com</td><td>c__Windows_win.com</td><tr><tr><td>/chat/stackoverflow/com/rooms/11.php</td><td>_chat_stackoverflow_com_rooms_11.php</td><tr><tr><td>I like goats</td><td>I like goats</td><tr></table>