Balakumar B Balakumar B -4 years ago 132
Javascript Question

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

JAVASCRIPT

var lblname = "Location Details";

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


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

Answer Source

You can use

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