PHP : Removes single and double quotes from a string

In this tutorial learn how to Removes single and double quotes from a string using str_replace() method.

Tutorial

<?php
    /**
  * Strip Quotes
  *
  * Removes single and double quotes from a string
  *
  * @param string
  * @return string
  */
 function strip_quotes($str)
 {
  return str_replace(array('"', "'"), '', $str);
 }

 echo strip_quotes("f\\'oo b\\'ar'");
?>
Above Tutorial Output :


f\oo `b\ar

No comments:

Post a Comment

how to call ssh from vs code

 To call SSH from VS Code, you can use the built-in Remote Development extension. This extension allows you to open a remote folder or works...