scripts/CodeMirror/mode/php/index.html (view raw)
1<!doctype html>
2
3<title>CodeMirror: PHP mode</title>
4<meta charset="utf-8"/>
5<link rel=stylesheet href="../../doc/docs.css">
6
7<link rel="stylesheet" href="../../lib/codemirror.css">
8<script src="../../lib/codemirror.js"></script>
9<script src="../../addon/edit/matchbrackets.js"></script>
10<script src="../htmlmixed/htmlmixed.js"></script>
11<script src="../xml/xml.js"></script>
12<script src="../javascript/javascript.js"></script>
13<script src="../css/css.js"></script>
14<script src="../clike/clike.js"></script>
15<script src="php.js"></script>
16<style>.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
17<div id=nav>
18 <a href="https://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
19
20 <ul>
21 <li><a href="../../index.html">Home</a>
22 <li><a href="../../doc/manual.html">Manual</a>
23 <li><a href="https://github.com/codemirror/codemirror">Code</a>
24 </ul>
25 <ul>
26 <li><a href="../index.html">Language modes</a>
27 <li><a class=active href="#">PHP</a>
28 </ul>
29</div>
30
31<article>
32<h2>PHP mode</h2>
33<form><textarea id="code" name="code">
34<?php
35$a = array('a' => 1, 'b' => 2, 3 => 'c');
36
37echo "$a[a] ${a[3] /* } comment */} {$a[b]} \$a[a]";
38
39function hello($who) {
40 return "Hello $who!";
41}
42?>
43<p>The program says <?= hello("World") ?>.</p>
44<script>
45 alert("And here is some JS code"); // also colored
46</script>
47</textarea></form>
48
49 <script>
50 var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
51 lineNumbers: true,
52 matchBrackets: true,
53 mode: "application/x-httpd-php",
54 indentUnit: 4,
55 indentWithTabs: true
56 });
57 </script>
58
59 <p>Simple HTML/PHP mode based on
60 the <a href="../clike/">C-like</a> mode. Depends on XML,
61 JavaScript, CSS, HTMLMixed, and C-like modes.</p>
62
63 <p><strong>MIME types defined:</strong> <code>application/x-httpd-php</code> (HTML with PHP code), <code>text/x-php</code> (plain, non-wrapped PHP code).</p>
64 </article>