3v4l.org

run code in 300+ PHP versions simultaneously
<?php function fixtags($text){ $text = htmlspecialchars($text); console.log($text); $text = preg_replace("/=/", "=\"\"", $text); console.log($text); $text = preg_replace("/&quot;/", "&quot;\"", $text); console.log($text); $tags = "/&lt;(\/|)(\w*)(\ |)(\w*)([\\\=]*)(?|(\")\"&quot;\"|)(?|(.*)?&quot;(\")|)([\ ]?)(\/|)&gt;/i(\&lt;h[1-9]&gt;)"; $replacement = "<$1$2$3$4$5$6$7$8$9$10>"; $text = preg_replace($tags, $replacement, $text); console.log($text); $text = preg_replace("/=\"\"/", "=", $text); console.log($text); return $text; }?> <?php echo fixtags(' content of website ... <h1> Heading (?= 1 for largest to 6 for smallest, eg h1) </h1> <p> Paragraph of Text </p> <b> Bold Text </b> <a href="url"> ... </a> <i> Italic Text </i> <u> Underline Text </u> <strike> Strikeout </strike> <sup> Superscript - Smaller text placed below normal text </sup> <sub> ... </sub>');
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
Fatal error: Uncaught Error: Undefined constant "console" in /in/VUGqT:5 Stack trace: #0 /in/VUGqT(19): fixtags(' content of we...') #1 {main} thrown in /in/VUGqT on line 5
Process exited with code 255.
Output for 7.2.6 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33
Warning: Use of undefined constant console - assumed 'console' (this will throw an Error in a future version of PHP) in /in/VUGqT on line 5 Warning: log() expects parameter 1 to be float, string given in /in/VUGqT on line 5 Warning: Use of undefined constant console - assumed 'console' (this will throw an Error in a future version of PHP) in /in/VUGqT on line 7 Warning: log() expects parameter 1 to be float, string given in /in/VUGqT on line 7 Warning: Use of undefined constant console - assumed 'console' (this will throw an Error in a future version of PHP) in /in/VUGqT on line 9 Warning: log() expects parameter 1 to be float, string given in /in/VUGqT on line 9 Warning: preg_replace(): Unknown modifier '(' in /in/VUGqT on line 12 Warning: Use of undefined constant console - assumed 'console' (this will throw an Error in a future version of PHP) in /in/VUGqT on line 13 Warning: Use of undefined constant console - assumed 'console' (this will throw an Error in a future version of PHP) in /in/VUGqT on line 15 Warning: log() expects parameter 1 to be float, string given in /in/VUGqT on line 15
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.33
Notice: Use of undefined constant console - assumed 'console' in /in/VUGqT on line 5 Warning: log() expects parameter 1 to be float, string given in /in/VUGqT on line 5 Notice: Use of undefined constant console - assumed 'console' in /in/VUGqT on line 7 Warning: log() expects parameter 1 to be float, string given in /in/VUGqT on line 7 Notice: Use of undefined constant console - assumed 'console' in /in/VUGqT on line 9 Warning: log() expects parameter 1 to be float, string given in /in/VUGqT on line 9 Warning: preg_replace(): Unknown modifier '(' in /in/VUGqT on line 12 Notice: Use of undefined constant console - assumed 'console' in /in/VUGqT on line 13 Notice: Use of undefined constant console - assumed 'console' in /in/VUGqT on line 15 Warning: log() expects parameter 1 to be float, string given in /in/VUGqT on line 15
Output for 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.24 - 5.5.35, 5.6.8 - 5.6.28
Notice: Use of undefined constant console - assumed 'console' in /in/VUGqT on line 5 Warning: log() expects parameter 1 to be double, string given in /in/VUGqT on line 5 Notice: Use of undefined constant console - assumed 'console' in /in/VUGqT on line 7 Warning: log() expects parameter 1 to be double, string given in /in/VUGqT on line 7 Notice: Use of undefined constant console - assumed 'console' in /in/VUGqT on line 9 Warning: log() expects parameter 1 to be double, string given in /in/VUGqT on line 9 Warning: preg_replace(): Unknown modifier '(' in /in/VUGqT on line 12 Notice: Use of undefined constant console - assumed 'console' in /in/VUGqT on line 13 Notice: Use of undefined constant console - assumed 'console' in /in/VUGqT on line 15 Warning: log() expects parameter 1 to be double, string given in /in/VUGqT on line 15
Output for 4.3.11, 4.4.0 - 4.4.9, 5.0.0 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17
Notice: Use of undefined constant console - assumed 'console' in /in/VUGqT on line 5 Notice: Use of undefined constant console - assumed 'console' in /in/VUGqT on line 7 Notice: Use of undefined constant console - assumed 'console' in /in/VUGqT on line 9 Warning: preg_replace(): Unknown modifier '(' in /in/VUGqT on line 12 Notice: Use of undefined constant console - assumed 'console' in /in/VUGqT on line 13 Notice: Use of undefined constant console - assumed 'console' in /in/VUGqT on line 15
Output for 4.3.0 - 4.3.10
Notice: Use of undefined constant console - assumed 'console' in /in/VUGqT on line 5 Notice: Use of undefined constant console - assumed 'console' in /in/VUGqT on line 7 Notice: Use of undefined constant console - assumed 'console' in /in/VUGqT on line 9 Warning: Unknown modifier '(' in /in/VUGqT on line 12 Notice: Use of undefined constant console - assumed 'console' in /in/VUGqT on line 13 Notice: Use of undefined constant console - assumed 'console' in /in/VUGqT on line 15

preferences:
186.05 ms | 402 KiB | 341 Q