<?php $str = 'Hello world //this is a commentTesting //not testingTest again'; echo preg_replace('~//.*$~m', '', $str);
Standard input is empty
Hello world Testing Test again
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!