Tag

string escaping

1 views collected around this technical thread.

php中文网 Courses
php中文网 Courses
Dec 15, 2023 · Backend Development

Using PHP htmlspecialchars() to Escape Special Characters

This article explains the PHP htmlspecialchars() function, its syntax and parameters, demonstrates how to escape special characters, quotes, and specify encoding or disable double‑encoding, and shows how it helps prevent XSS attacks in web applications.

BackendXSShtmlspecialchars
0 likes · 4 min read
Using PHP htmlspecialchars() to Escape Special Characters
php中文网 Courses
php中文网 Courses
Sep 21, 2023 · Backend Development

PHP quotemeta() Function: Syntax, Usage, and Replacement with preg_quote()

The article explains PHP's quotemeta() function, which escapes special regex characters in a string, details its syntax and parameters, lists the characters it escapes, notes its deprecation after PHP 5.3, and recommends using the newer preg_quote() function with example code.

backend developmentphppreg_quote
0 likes · 3 min read
PHP quotemeta() Function: Syntax, Usage, and Replacement with preg_quote()
php中文网 Courses
php中文网 Courses
Sep 20, 2023 · Backend Development

PHP stripslashes() Function: Syntax, Usage, and Precautions

The article explains PHP's stripslashes() function, its syntax, how to use it for removing backslash escapes in strings and database results, precautions such as escape order and scope, and best practices for safe string handling.

Backendaddslashesdatabase
0 likes · 6 min read
PHP stripslashes() Function: Syntax, Usage, and Precautions
php中文网 Courses
php中文网 Courses
Sep 19, 2023 · Backend Development

Understanding PHP's addslashes() Function: Syntax, Usage, and Security Considerations

The article explains PHP's addslashes() function, detailing its syntax, how it escapes specific characters, provides code examples, demonstrates its role in preventing SQL injection, and advises using stronger escaping methods such as mysqli_real_escape_string or PDO prepared statements.

SQL InjectionSecurityaddslashes
0 likes · 6 min read
Understanding PHP's addslashes() Function: Syntax, Usage, and Security Considerations
php中文网 Courses
php中文网 Courses
Sep 16, 2023 · Information Security

How to Use PHP htmlspecialchars() to Escape Special Characters and Prevent XSS

This article explains the purpose, syntax, optional parameters, and practical examples of PHP's htmlspecialchars() function, demonstrating how to safely convert special characters to HTML entities, control encoding and flags, avoid double‑encoding, and follow important usage considerations for secure web development.

BackendWeb SecurityXSS
0 likes · 6 min read
How to Use PHP htmlspecialchars() to Escape Special Characters and Prevent XSS