mirror of
https://github.com/igorsimdyanov/php8.git
synced 2025-08-10 03:01:01 +00:00
16 lines
404 B
PHP
16 lines
404 B
PHP
<?php
|
|
$str = '<hTmL><bOdY>Hello, world!</bOdY></html>';
|
|
|
|
$str = preg_replace_callback_array(
|
|
[
|
|
'{(?<btag></?)(?<content>\w+)(?<etag>.*?>)}s' => function($m) {
|
|
return $m['btag'].strtoupper($m['content']).$m['etag'];
|
|
},
|
|
'{(?<=>)([^<>]+?)(?=<)}s' => function($m){
|
|
return "<strong>$m[1]</strong>";
|
|
}
|
|
],
|
|
$str);
|
|
|
|
echo htmlspecialchars($str);
|