3v4l.org

run code in 300+ PHP versions simultaneously
<?php class ThreePointStudio_CustomMarkupForUser_Constants { public static $availableMarkups = array( // Text Effects "bold" => array( "format" => array( array("span", array("style" => array("font-weight" => array("bold")))) ), ), "italic" => array( "format" => array( array("span", array("style" => array("font-style" => array("italic")))) ), ), "underline" => array( "format" => array( array("span", array("style" => array("text-decoration" => array("underline"))), array('mergeProperties' => true)) ), ), "overline" => array( "format" => array( array("span", array("style" => array("text-decoration" => array("overline"))), array('mergeProperties' => true)) ), ), "strike" => array( "format" => array( array("span", array("style" => array("text-decoration" => array("line-through"))), array('mergeProperties' => true)) ), ), "text_colour" => array( "format" => array( array("span", array("style" => array("color" => array("{_value}"))), array("variableFeed" => array("_value"))) ), ), "font_face" => array( "format" => array( array("span", array("style" => array("font-family" => array("{fontFamily}"))), array("variableFeed" => array("fontFamily"))) ), ), // Background and Borders "background_colour" => array( "format" => array( array("span", array("style" => array("background-color" => array("{_value}"))), array("variableFeed" => array("_value"))) ), ), "border" => array( "format" => array( array("span", array("class" => array("borderText"))) ), ), "border_colour" => array( "format" => array( array("span", array("style" => array("border-color" => array("{_value}"))), array("variableFeed" => array("_value"))) ), ), "border_style" => array( "format" => array( array("span", array("style" => array("border-style" => array("{borderStyle}"))), array("variableFeed" => array("borderStyle"))) ), ), ); public static $borderList = array( 0 => "none", 1 => "dotted", 2 => "dashed", 3 => "solid", 4 => "double", 5 => "groove", 6 => "ridge", 7 => "inset", 8 => "outset" ); // Mostly copied from http://www.ampsoft.net/webdesign-l/WindowsMacFonts.html public static $fontList = array( 0 => array("name" => "", "fullname" => "inherit"), 1 => array("name" => "Arial", "fullname" => 'Arial, Helvetica, sans-serif'), 2 => array("name" => "Arial Black", "fullname" => "'Arial Black', Gadget, sans-serif"), 3 => array("name" => "Comic Sans MS", "fullname" => "'Comic Sans MS', cursive, sans-serif"), 4 => array("name" => "Courier New", "fullname" => "'Courier New', Courier, monospace"), 5 => array("name" => "Georgia", "fullname" => 'Georgia, serif'), 6 => array("name" => "Impact", "fullname" => 'Impact, Charcoal, sans-serif'), 7 => array("name" => "Lucida Console", "fullname" => "'Lucida Console', Monaco, monospace"), 8 => array("name" => "Lucida Sans Unicode", "fullname" => "'Lucida Sans Unicode', 'Lucida Grande', sans-serif"), 9 => array("name" => "Palatino Linotype", "fullname" => "'Palatino Linotype', 'Book Antiqua', Palatino, serif"), 10 => array("name" => "Tahoma", "fullname" => 'Tahoma, Geneva, sans-serif'), 11 => array("name" => "Times New Roman", "fullname" => "'Times New Roman', Times, serif"), 12 => array("name" => "Trebuchet MS", "fullname" => "'Trebuchet MS', Helvetica, sans-serif"), 13 => array("name" => "Verdana", "fullname" => 'Verdana, Geneva, sans-serif'), ); public static $defaultOptionsArray = array( "username" => array(), "usertitle" => array() ); } $options = unserialize('a:2:{s:8:"username";a:9:{s:4:"bold";i:1;s:6:"italic";i:1;s:9:"underline";i:1;s:11:"text_colour";s:7:"#e01be0";s:9:"font_face";i:13;s:17:"background_colour";s:7:"#4683ab";s:6:"border";i:1;s:13:"border_colour";s:7:"#d91fd9";s:12:"border_style";i:1;}s:9:"usertitle";a:6:{s:4:"bold";i:1;s:6:"italic";i:1;s:9:"underline";i:1;s:6:"strike";i:1;s:8:"overline";i:1;s:9:"font_face";i:3;}}'); $sortedTags = $firstOccurrence = array(); foreach ($options[$category] as $optionName => $optionValue) { end($sortedTags); foreach (ThreePointStudio_CustomMarkupForUser_Constants::$availableMarkups[$optionName]["format"] as $tag) { $sortedTags[] = $tag; end($sortedTags); $index = key($sortedTags); $theTag = &$sortedTags[$index]; if (!in_array($theTag[0], $firstOccurrence)) { $firstOccurrence[$theTag[0]] = $index; } else { // Try to see if we can merge the properties if (isset($theTag[2]["loneTag"]) && $theTag[2]["loneTag"]) { // It wants it own tag continue; } $firstOccurrenceTag = &$sortedTags[$firstOccurrence[$theTag[0]]]; $intersection = array_keys(array_intersect_key($theTag[1], $firstOccurrenceTag[1])); if (in_array("style", $intersection)) { if ((isset($theTag[2]["mergeProperties"]) && $theTag[2]["mergeProperties"]) && (isset($firstOccurrenceTag[2]["mergeProperties"]) && $firstOccurrenceTag[2]["mergeProperties"])) { $firstOccurrenceTag[1]["style"] = array_replace_recursive($firstOccurrenceTag[1]["style"], $theTag[1]["style"]); } else { $firstOccurrenceTag[1]["style"] = array_replace($firstOccurrenceTag[1]["style"], $theTag[1]["style"]); } unset($theTag[1]["style"]); } if (in_array("class", $intersection)) { $firstOccurrenceTag[1]["class"] = array_replace($firstOccurrenceTag[1]["class"], $theTag[1]["class"]); unset($theTag[1]["class"]); } // Try to put anything that is not in the first occurrence tag into the first occurrence tag instead foreach ($theTag[1] as $attr => $attrValue) { if (!in_array($attr, array_keys($firstOccurrenceTag[1]))) { $firstOccurrenceTag[1][$attr] = $attrValue; unset($theTag[1][$attr]); } } if (empty($theTag[1])) { // No attr, drop the tag unset($sortedTags[$index]); end($sortedTags); continue; } // What is left is conflicted attributes. Leave as is in its own tag. } } } var_dump($sortedTags);
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.27, 8.2.0 - 8.2.17, 8.3.0 - 8.3.4
Warning: Undefined variable $category in /in/2v0li on line 105 Warning: Undefined array key "" in /in/2v0li on line 105 Warning: foreach() argument must be of type array|object, null given in /in/2v0li on line 105 array(0) { }
Output for 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.40, 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.31, 7.4.0 - 7.4.33
Notice: Undefined variable: category in /in/2v0li on line 105 Notice: Undefined index: in /in/2v0li on line 105 Warning: Invalid argument supplied for foreach() in /in/2v0li on line 105 array(0) { }
Output for 7.3.32 - 7.3.33
Warning: Invalid argument supplied for foreach() in /in/2v0li on line 105 array(0) { }
Output for 5.2.1 - 5.2.17
Notice: Undefined variable: category in /in/2v0li on line 105 Notice: Undefined index: in /in/2v0li on line 105 Warning: Invalid argument supplied for foreach() in /in/2v0li on line 105 array(0) { }
Output for 5.0.4 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0
Notice: Undefined variable: category in /in/2v0li on line 105 Warning: Invalid argument supplied for foreach() in /in/2v0li on line 105 array(0) { }
Output for 5.0.0 - 5.0.3
Notice: Undefined variable: category in /in/2v0li on line 105 Warning: Invalid argument supplied for foreach() in /in/2v0li on line 105 array(0) { }
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/2v0li on line 5
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.3.11, 4.4.0 - 4.4.1
Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/2v0li on line 5
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or `T_VAR' or `'}'' in /in/2v0li on line 5
Process exited with code 255.

preferences:
300.84 ms | 401 KiB | 456 Q