3v4l.org

run code in 300+ PHP versions simultaneously
<?php $htmlentitiesTabel = get_html_translation_table(HTML_ENTITIES); function Kleuren($code) { global $htmlentitiesTabel; $code = trim($code); $aantal = substr_count($code,"\n")+1; $gekleurd = highlight_string($code,true); $gekleurd = str_replace(array('<font ', '</font>'), array('<span ', '</span>'), $gekleurd); $gekleurd = preg_replace('#color="(.*?)"#', 'style="color: \\1"', $gekleurd); $tabel = $htmlentitiesTabel; unset($tabel['<']); unset($tabel['>']); unset($tabel['&']); unset($tabel['\'']); unset($tabel['"']); $gekleurd = strtr($gekleurd, $tabel); $breedte = strlen($aantal)*7; $hoogteblok = $aantal > 25 ? "308" : $aantal*12+26; $hoogteregels = $aantal*12+16; $blok = "<div class='Codeblok' style='height: $hoogteblok"."px".($aantal <= 25 ? "; overflow-y: hidden" : "")."'> <table cellpadding='0' cellspacing='0'> <tr> <td class='CodeblokRegels' style='height: $hoogteregels"."px; width: $breedte"."px'> <code>"; for($i = 1; $i <= $aantal; $i++) { $blok .= "$i<br>"; } $blok .= " </code> </td> <td class='CodeblokCode'> $gekleurd </td> </tr> </table> </div>"; return $blok; } function Tekst($waarde) { global $htmlentitiesTabel; $waarde = str_replace("§","&sect;",$waarde); preg_match_all("#\[code\](.*?)\[/code\](\r)?(\n)?#is", $waarde, $GeenSmilies['code']); preg_match_all("#\[php\](.*?)\[/php\](\r)?(\n)?#is", $waarde, $GeenSmilies['php']); foreach($GeenSmilies as $i => $code) { foreach($code[0] as $nr => $tekst) { $waarde = str_replace($tekst,"§".$i.$nr."§",$waarde); } } $waarde = htmlentities($waarde,ENT_QUOTES); } // Smilies vervangen // UBB-codes vervangen $waarde = nl2br($waarde); foreach($GeenSmilies as $i => $code) { foreach($code[1] as $nr => $tekst) { $waarde = str_replace("&sect;$i$nr&sect;",Kleuren($tekst),$waarde); } } $waarde = str_replace("&amp;sect;","&sect;",$waarde);
Output for 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.7
Warning: Undefined variable $waarde in /in/U62nS on line 68 Deprecated: nl2br(): Passing null to parameter #1 ($string) of type string is deprecated in /in/U62nS on line 68 Warning: Undefined variable $GeenSmilies in /in/U62nS on line 70 Warning: foreach() argument must be of type array|object, null given in /in/U62nS on line 70
Output for 8.0.0 - 8.0.30
Warning: Undefined variable $waarde in /in/U62nS on line 68 Warning: Undefined variable $GeenSmilies in /in/U62nS on line 70 Warning: foreach() argument must be of type array|object, null given in /in/U62nS on line 70
Output for 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.24 - 5.5.35, 5.6.8 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.20, 7.2.0 - 7.2.33, 7.3.16 - 7.3.31, 7.4.0 - 7.4.33
Notice: Undefined variable: waarde in /in/U62nS on line 68 Notice: Undefined variable: GeenSmilies in /in/U62nS on line 70 Warning: Invalid argument supplied for foreach() in /in/U62nS on line 70
Output for 7.3.32 - 7.3.33
Warning: Invalid argument supplied for foreach() in /in/U62nS on line 70
Output for 5.0.4 - 5.0.5
Notice: Undefined variable: waarde in /in/U62nS on line 68 Warning: Invalid argument supplied for foreach() in /in/U62nS on line 70
Output for 4.3.0 - 4.3.10, 4.4.0 - 4.4.9, 5.0.0 - 5.0.3
Notice: Undefined variable: waarde in /in/U62nS on line 68 Warning: Invalid argument supplied for foreach() in /in/U62nS on line 70
Output for 4.3.11
Notice: Undefined variable: waarde in /in/U62nS on line 68

preferences:
211.69 ms | 401 KiB | 313 Q