Example 1 — Check for Common String Filters
Ask whether a few built-in string filters are present and print yes or no for each.
<?php
$filters = stream_get_filters();
$want = ["string.toupper", "string.tolower", "string.rot13"];
foreach ($want as $name) {
echo $name, ": ", in_array($name, $filters, true) ? "yes" : "no", PHP_EOL;
} How It Works
- stream_get_filters() returns every known filter name.
- We loop over three common built-in string filters.
- in_array() reports whether each name appears in the list.
- A normal PHP install includes these three, so each line prints yes.

