String Filters

Each of these filters does precisely what their name implies and correspond to the behavior of a built-in php string handling function. For more information on a given filter, refer to the manual page for the corresponding function.

string.rot13

Use of this filter is equivalent to processing all stream data through the str_rot13() function.

Example #1 string.rot13

<?php
$fp 
fopen('php://output''w');
stream_filter_append($fp'string.rot13');
fwrite($fp"This is a test.\n");
/* Outputs:  Guvf vf n grfg.   */
?>

string.toupper

Use of this filter is equivalent to processing all stream data through the strtoupper() function.

Example #2 string.toupper

<?php
$fp 
fopen('php://output''w');
stream_filter_append($fp'string.toupper');
fwrite($fp"This is a test.\n");
/* Outputs:  THIS IS A TEST.   */
?>

string.tolower

Use of this filter is equivalent to processing all stream data through the strtolower() function.

Example #3 string.tolower

<?php
$fp 
fopen('php://output''w');
stream_filter_append($fp'string.tolower');
fwrite($fp"This is a test.\n");
/* Outputs:  this is a test.   */
?>

string.strip_tags

Use of this filter is equivalent to processing all stream data through the strip_tags() function. It accepts parameters in one of two forms: Either as a string containing a list of tags similar to the second parameter of the strip_tags() function, or as an array of tag names.

Warning

This feature has been DEPRECATED as of PHP 7.3.0. Relying on this feature is highly discouraged.

Example #4 string.strip_tags

<?php
$fp 
fopen('php://output''w');
stream_filter_append($fp'string.strip_tags'STREAM_FILTER_WRITE"<b><i><u>");
fwrite($fp"<b>bolded text</b> enlarged to a <h1>level 1 heading</h1>\n");
fclose($fp);
/* Outputs:  bolded text enlarged to a level 1 heading   */

$fp fopen('php://output''w');
stream_filter_append($fp'string.strip_tags'STREAM_FILTER_WRITE, array('b','i','u'));
fwrite($fp"<b>bolded text</b> enlarged to a <h1>level 1 heading</h1>\n");
fclose($fp);
/* Outputs:  bolded text enlarged to a level 1 heading   */
?>

Here you can write a comment


Please enter at least 10 characters.
Loading... Please wait.
* Pflichtangabe
There are no comments available yet.

PHP cURL Tutorial: Using cURL to Make HTTP Requests

cURL is a powerful PHP extension that allows you to communicate with different servers using various protocols, including HTTP, HTTPS, FTP, and more. ...

TheMax

Autor : TheMax
Category: PHP-Tutorials

Midjourney Tutorial - Instructions for beginners

There is an informative video about Midjourney, the tool for creating digital images using artificial intelligence, entitled "Midjourney tutorial in German - instructions for beginners" ...

Mike94

Autor : Mike94
Category: KI Tutorials

Basics of views in MySQL

Views in a MySQL database offer the option of creating a virtual table based on the result of an SQL query. This virtual table can be queried like a normal table without changing the underlying data. ...

admin

Autor : admin
Category: mySQL-Tutorials

Publish a tutorial

Share your knowledge with other developers worldwide

Share your knowledge with other developers worldwide

You are a professional in your field and want to share your knowledge, then sign up now and share it with our PHP community

learn more

Publish a tutorial