<?php

function remove_comment($str)
{
    return preg_replace('/\/\*.*?(\*\/|$)/', '', $str);
}

echo remove_comment('AAA')."\n";
echo remove_comment('AAA/*BBB*/')."\n";
echo remove_comment('AAA/*BBB')."\n";
echo remove_comment('AAA/*BBB/*CCC*/')."\n";
echo remove_comment('AAA/*BBB/*CCC*/DDD*/EEE')."\n";
