function Array_Sort($arr, $index, $order = 'asc') {
$b = array();
$c = array();
foreach ($arr as $key => $value) {
$b[$key] = $value[$index];
}
if ($order == 'asc')
asort($b);
elseif ($order == 'desc')
arsort($b);
foreach ($b as $key => $value) {
$c[] = $arr[$key];
}
return $c;
}
#include <stdio.h>
#include <string.h>
void main()
{
const char *scan = "Scan Terminal", *terminal = "Terminal";
char *node;
int pos;
node = strstr(scan, terminal);
pos = node - scan;
printf("Scanned, \"%s\". For, \"%s\" (at position %d).\n", scan, node,pos);
}
<script type="text/javascript">
// Say hello world until the user starts questioning
// the meaningfulness of their existence.
function helloWorld(world) {
for (var i = 42; --i >= 0;) {
alert('Hello ' + String(world));
}
}
</script>
<style>
p { color: pink }
b { color: blue }
u { color: "umber" }
</style>
<?xml version="1.0" encoding="UTF-8"?>
<breakfast_menu>
<food>
<name>Belgian Waffles</name>
<price>$5.95</price>
<description>
Two of our famous Belgian Waffles with plenty of real maple syrup
</description>
<calories>650</calories>
</food>
<food>
<name>Strawberry Belgian Waffles</name>
<price>$7.95</price>
<description>
Light Belgian waffles covered with strawberries and whipped cream
</description>
<calories>900</calories>
</food>
<food>
<name>Berry-Berry Belgian Waffles</name>
<price>$8.95</price>
<description>
Belgian waffles covered with assorted fresh berries and whipped cream
</description>
<calories>900</calories>
</food>
<food>
<name>French Toast</name>
<price>$4.50</price>
<description>
Thick slices made from our homemade sourdough bread
</description>
<calories>600</calories>
</food>
<food>
<name>Homestyle Breakfast</name>
<price>$6.95</price>
<description>
Two eggs, bacon or sausage, toast, and our ever-popular hash browns
</description>
<calories>950</calories>
</food>
</breakfast_menu>
/*
A short example of stringing questions together
to learn something about the user
*/
// Start the goal from scratch for demo purposes.
i: start books;
s: $userbook = "";
s: $userbookauth = "";
s: $userbookmovie = "";
o: okay;
// Escaping further questions for demo purposes.
f: $goal != "";
i: break;
o: Okay I will stop !;
s: $goal = "";
f:;
// This starts the series of questions. Or says what the bot already knows.
i: i like books;
c: ($userbook == "") {
o: What is your favourite book ?;
s: $prev = "what is your favourite book";
s: $goal = "book";
}
e: c: ($userbook != "") {
o: Yes I know you like $userbook.;
c: ($userbookauth != "")
o: I also know that it was written by $userbookauth.;
c: ($userbookkind != "")
o: And that $userbookkind too !;
}
// Asking Questions.
f: $goal == "book" && $prev == "what is your favourite book";
i: %||it is %||my favourite book is %||that is %||i really like %;
s: $userbook = %1;
s: $prev = "who wrote that";
o: Hmm $userbook, who wrote that ?;
f:;
f: $goal == "book" && $prev == "who wrote that";
i: %;
s: $userbookauth = %1;
s: $prev = "what kind of book is it";
o: Nice. So you like $userbook by $userbookauth, cool.;
o: What kind of book is it ?;
f:;
f: $goal == "book" && $prev == "what kind of book is it";
i: %;
s: $userbookkind = %1;
s: $prev = "";
o: $userbookkind, I think I might like it then;
f:;
var PR_KEYWORD_COMMON = "kwd";
var PR_KEYWORD_C = "kwd";
var PR_KEYWORD_ELF = "kwd";
var PR_OPERATOR_ELF = "opr";
var PR_KEYWORD_PY = "kwd";
var PR_FUNCTION = "fun";
var PR_VAR_PHP = "var";
var PR_COMMENT = "com";
var PR_FLOW_CONTROL = "flow";
var PR_STRING = "str";
var PR_LITERAL = "lit";
PR.registerLangHandler(
PR.createSimpleLexer(
[], [
//[PR_STRING, /(i:|o:|s:|f:|e:|c:)(.*?);/],
// Unescaped content in an unknown language
['lang-', /^<\?([\s\S]+?)(?:\?>|$)/],
['lang-', /^<%([\s\S]+?)(?:%>|$)/],
['lang-', /^<xmp\b[^>]*>([\s\S]+?)<\/xmp\b[^>]*>/i],
// Unescaped content in javascript. (Or possibly vbscript).
['lang-js', /^<script\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],
// Contains unescaped stylesheet content
['lang-css', /^<style\b[^>]*>([\s\S]*?)(<\/style\b[^>]*>)/i],
['lang-in.tag', /^(<\/?[a-z][^<>]*>)/i],
[PR_STRING, /^(?:"(?:[^\\"\r\n]|\\.)*(?:"|$))/],
[PR_FUNCTION, /\b(function)\b/],
[PR_VAR_PHP, /\$[a-z]+/],
[PR_KEYWORD_C, /\b(auto|case|char|const|default|double|enum|extern|float|goto|inline|int|long|register|restrict|short|signed|sizeof|static|struct|switch|typedef|union|unsigned|void|volatile)\b/],
[PR_COMMENT, /^\/\/[^\r\n]*/],
[PR_COMMENT, /^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/],
[PR_FLOW_CONTROL, /\b(break|continue|do|else|for|if|elseif|else|foreach|return|while)\b/],
[PR_STRING, /^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/],
[PR_KEYWORD_PY, /\b(and|as|assert|class|def|del|elif|except|exec|finally|from|global|import|in|is|lambda|nonlocal|not|or|pass|print|raise|try|with|yield|False|True|None)\b/],
[PR_LITERAL, /[%0-9]/],
]), ['aidreams']);
[PR_STRING, /^(?:"(?:[^\\"\r\n]|\\.)*(?:"|$))/]
/^(?:[io]:(?:[^\\"\r\n]|\\.)*(?:$))/
<?xml version = "1.0" encoding = "UTF-8"?>
<aiml>
<category>
<pattern>HEY FREDDY</pattern>
<template>What's up?</template>
</category>
<category>
<pattern>THANKS</pattern>
<template>You're welcome!</template>
</category>
</aiml>
#!/bin/bash
read -p "Who are you? " who
echo "Hello, $who. Let's chat!"