0

A code to deeply remove multiple quote’s (\\\\’) and make it just a single quote ‘ and so on

Posted April 15th, 2010 in PHP, Programming and tagged , , by Louie Miranda

The PHP string function “stripslashes” only remove’s a certain “\” on a string. Here’s a good code I found to deeply remove multiple \\\\\ on a string.

1
2
3
4
5
6
7
8
9
10
<?php
function stripslashesdeeply($text, $times) {
    $i = 0;
    while (strstr($text, '\\') && $i != $times) {
        $text = stripslashes($text);
        $i++;
    }
    return $text;
}
?>

Leave a Reply