Back
Syntax
Study
Editor
Mode:
HTML
CSS
JavaScript
PHP
Reset
Run »
HTML / CSS / JS
<?php // Convert Markdown headers to HTML $html = preg_replace_callback( "/^(#{1,6})\s+(.+)$/m", function (array $matches): string { $level = strlen($matches[1]); return "<h{$level}>{$matches[2]}</h{$level}>"; }, $markdown ); // Currency formatting $result = preg_replace_callback( "/\$(\d+)/", fn($m) => "$" . number_format((int) $m[1], 2), "$1000 and $250 spent" ); // "$1,000.00 and $250.00 spent"
Result
Open