<?php $input = 'z-edu-l1-^threat -emergency mk pl.jpg';echo strtolower(preg_replace('/[^\w.-]/', '_', trim($input)));
Standard input is empty
z-edu-l1-_threat_-emergency_mk_pl.jpg
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!