Fork me on GitHub

JavaScript

x
1487
14
1487
 
1
// SQL 分析
2
3
var z_sql_parser8 = function() {
4
    ;
5
};
6
7
z_sql_parser8.prototype.args = {
8
    // 关键词
9
    'keyword':{
10
        // 方法
11
        'WAY':['SELECT','UPDATE','DELETE','INSERT'],
12
        // 块
13
        'block':['FROM','SET','JOIN','WHERE','ORDER','HAVING','GROUP','LIMIT'],
14
        // 块 相关
15
        'relevant':['BY','INNER','OUTTER','LEFT','RIGHT'],
16
        // 连接
17
        'link':['AS','OR','AND','SET','VALUES','IN','NOT','ASC','DESC','UNION'],
18
        // 函数
19
        'fun':['IN','NOT IN','MAX','MIN','SUM','AVG','COUNT','CONCAT'],
20
    }
21
};
22
z_sql_parser8.prototype.take = [];
23
24
// 提取 字符串
25
z_sql_parser8.prototype.str_extract = function(sql) {
26
    var self = this;
27
    this.take = [];
28
29
    // 提取 转义的单引号
30
    sql = sql.replace(/[\\]+'/gi,function(a){
31
        self.take.push(a);

PHP

1
36
 
1
<?php
2
$x = 1;
3
$y = 50;
4
$ternary = ($x == 1) ? "Yes" : "No";
5
var_dump($ternary);
6
var_dump($x < $y);
7
var_dump($x == 2);
8
if ($x < $y) {
9
echo("x < y");
10
} else if ($x == 2) {
11
echo("x==2");
12
} else {echo("else...");
13
}switch ($x){case 5:
14
echo("Five!");
15
16
case 1:
17
echo("One!");
18
19
default:
20
echo("Default!");
21
22
}