This is a complex demonstration of the PHP+HTML+JavaScript+CSS mixed-mode syntax highlight capabilities of CodeMirror. tags use the PHP parser, The PHP code below contains some deliberate errors. Play with the editor by fixing them and observing how the highlight changes. use_domain_object_builder
? $this->domain()->objectBuilder()
: null;
}
const $myconst = 'some string';
$array[myconst] = 4;
// this is a single-line C++-style comment
# this is a single-line shell-style comment
private var $a = __FILE__;
protected static $b = timezone_transitions_get('some parameter here');
global $g = isset("string");
static $s = hash_update_file; // warning: predefined function non-call
function mike ($var) $foo;
mike(A::func(param));
func($b $c); // error: function parameters must be comma-separated
foo bar; // error: no operator
$baz $quux; // error: no operator
public abstract function loadPageXML(util_FilePath $filename, $merge=0+$foo, $x, $y=3) {
$newrow[$key] = $val;
$newresult[] = $row;
$state = $row['c'] == 1;
$attribute_values[$attribute_name] = null;
$row['attributes'][$attribute_name] = $attribute_value;
$result[$row['element']][$row['attribute']] = $row['value'];
$sql = "multiline string
line2 is special - it'll interpolate variables like $state and method calls
{$this->cache->add($key, 5)} and maybe \"more\"
line5";
$sql = 'multiline string
single quoting means no \'interpolation\' like "$start" or method call
{$this->cache->add($key, 5)} will happen
line5';
$bitpattern = 1 << 2;
$bitpattern <<= 3;
$incorrect = <<< 5 EOSTRING // FIXME: CodeMirror update bug: add a letter before 5 and notice that syntax is not updated until EOF, even with continuousScanning: 500
error: the identifier must conform to the identifier rules
EOSTRING;
$sql = <<< EOSQL
SELECT attribute, element, value
FROM attribute_values
WHERE dimension = ?
EOSQL;
$this->lr_cache->add($key, self::range($row['lft'], $row['rgt']));
$composite_string = << The header above will say 'This is an example'.This is an example.
This is an example.