Balakumar B Balakumar B -4 years ago 132
Javascript Question

Is there replace function in php? like javascript replace()


var lblname = "Location Details";

console.log(lblname.replace(/[/\. ,:-]+/g, "-"));

i got Result
.. and as same opertaion how to do in php is there any php function available for this action?

Answer Source

You can use

    $lblname ="Location Details";
    echo preg_replace("/[\/\\. ,:-]+/","-",$lblname);
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download