PHP Filters in Hindi:- PHP Filters Ko External Input Ko Validate And Sanitize Karne Ke Liye Istemal Kiya Jata Hain |
- Validating data = Determine if the data is in proper form.
- Sanitizing data = Remove any illegal character from the data.
Yadi Aapne HTML Full Course And CSS Full Course And Python Full Course And PHP Full Course Nhi Read Kiya Hai To Aap Vah Bhi Read Kar Sakte Hai |
PHP Filters in Hindi
Contents
PHP Filters Extensions Mai User Input Ke Data Ko Filter Karne Ke Liye Functions Hai, Ise Data Validation Ko Aasan Or Fast Karne Ke Liye Design Kiya Gaya Hain |
filter_list() Function Ka Istemal PHP File Extension Ko Display Karne Ke Liye Kiya Jata Hain |
Example:
<!DOCTYPE html> <html> <head> <style> table, th, td { border: 1px solid Gray; border-collapse: collapse; } th, td { padding: 4px; } </style> </head> <body> <table> <tr> <td>Filter Name</td> <td>Filter ID</td> </tr> <?php foreach (filter_list() as $id =>$filter) { echo '<tr><td>' . $filter . '</td><td>' . filter_id($filter) . '</td></tr>'; } ?> </table> </body> </html>
Output:
Filter Name | Filter ID |
int | 257 |
boolean | 258 |
float | 259 |
validate_regexp | 272 |
validate_domain | 277 |
validate_url | 273 |
validate_email | 274 |
validate_ip | 275 |
validate_mac | 276 |
string | 513 |
stripped | 513 |
encoded | 514 |
special_chars | 515 |
full_special_chars | 522 |
unsafe_raw | 516 |
517 | |
url | 518 |
number_int | 519 |
number_float | 520 |
magic_quotes | 521 |
callback | 1024 |
PHP filter_var() Function in Hindi
Filter_var() Functions Validate And Sanitize Data Karta Hain | And Filter_var() Function Ek Single Variable Leta With Specified Filter |
PHP Sanitize a String in Hindi
<?php $str = "<h1>Hello World!</h1>"; $newstr = filter_var($str, FILTER_SANITIZE_STRING); echo $newstr; ?>
Output:
Hello World!
PHP Validate an Integer in Hindi
<?php $int = 100; if (!filter_var($int, FILTER_VALIDATE_INT) === false) { echo("Integer is valid"); } else { echo("Integer is not valid"); } ?>
Output:
Integer is valid