Topic: Code highlighting testi
package com.example
{
import flash.text.TextField;
import flash.display.Sprite;
public class Greeter extends Sprite
{
public function Greeter()
{
var txtHello:TextField = new TextField();
txtHello.text = "Hello World";
addChild(txtHello);
}
}
}
Flex AS 3.0
package
{
public class Greeter
{
public static function sayHello():String
{
var greet:String = "Hello, world!";
return greet;
}
}
}
XML test:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns="*" layout="vertical" creationComplete="initApp()">
<mx:Script>
<![CDATA[
public function initApp():void
{
// Prints our "Hello, world!" message into "mainTxt".
mainTxt.text = Greeter.sayHello();
}
]]>
</mx:Script>
<mx:Label id="title" fontSize="24" fontStyle="bold" text='"Hello, world!" Example'/>
<mx:TextArea id="mainTxt" width="250"/>
</mx:Application>
PHP
<?php
$string = 'The quick brown fox jumped over the lazy dog.';
$patterns[0] = '/quick/';
$patterns[1] = '/brown/';
$patterns[2] = '/fox/';
$replacements[2] = 'bear';
$replacements[1] = 'black';
$replacements[0] = 'slow';
echo preg_replace($patterns, $replacements, $string);
?>
