3v4l.org

run code in 500+ PHP versions simultaneously
<?php $dom = new DOMDocument(); $html = "<!DOCTYPE html><html><head><meta charset=utf-8><style>span::before{ content: \"⚡️\"; }</style></head><body><span></span></body></html>"; $html = mb_convert_encoding($html, 'HTML-ENTITIES', 'UTF-8'); $dom->loadHTML( $html ); echo $dom->saveHTML( $dom->documentElement ); echo "\n\n"; echo $dom->saveHTML();
Output for 8.2.0 - 8.2.30, 8.3.0 - 8.3.30, 8.4.1 - 8.4.18, 8.5.0 - 8.5.3
Deprecated: mb_convert_encoding(): Handling HTML entities via mbstring is deprecated; use htmlspecialchars, htmlentities, or mb_encode_numericentity/mb_decode_numericentity instead in /in/KZLZi on line 6 <html><head><meta charset="utf-8"><style>span::before{ content: "&#9889;&#65039;"; }</style></head><body><span></span></body></html> <!DOCTYPE html> <html><head><meta charset="utf-8"><style>span::before{ content: "&#9889;&#65039;"; }</style></head><body><span></span></body></html>
Output for 8.0.1 - 8.0.30, 8.1.0 - 8.1.34
<html><head><meta charset="utf-8"><style>span::before{ content: "&#9889;&#65039;"; }</style></head><body><span></span></body></html> <!DOCTYPE html> <html><head><meta charset="utf-8"><style>span::before{ content: "&#9889;&#65039;"; }</style></head><body><span></span></body></html>

preferences:
81.18 ms | 1163 KiB | 4 Q