Hướng dẫn
Quảng cáo

Hàm stripcslashes() trong PHP

Hướng dẫn cách sử dụng hàm stripcslashes() trong lập trình PHP

Tác dụng của hàm stripcslashes()

The stripcslashes() function removes backslashes added by the addcslashes() function.

The following table summarizes the technical details of this function.

Return Value: Returns the unescaped string.
Version: PHP 4+

Syntax

The basic syntax of the stripcslashes() function is given with:

stripcslashes(string);

The following example shows the stripcslashes() function in action.

<?php
// Sample string
$str = "C:\Users\Downloads";

// Unescaping string
echo stripcslashes($str);
?>

Tip: The stripcslashes() function do not skip the C-style escape sequences \a, \b, \f, \n, \r, \t and \v, but converts them to their literal equivalents or actual meaning.


Parameters

The stripcslashes() function accepts the following parameters.

Parameter Description
string Required. Specifies the string to be unescaped.

More Examples

Here're some more examples showing how stripcslashes() function actually works:

In the following example no backslashes are stripped off by this function.

<?php
// Sample string
$str = "Hi\tJohn!\r\nHow are you?";

// Unescaping string
echo stripcslashes($str);
?>

Bài viết này đã giúp ích cho bạn?

Bài viết mới

Advertisements