本文整理汇总了PHP中clsTinyButStrong::f_Misc_DelDelimiter方法的典型用法代码示例。如果您正苦于以下问题:PHP clsTinyButStrong::f_Misc_DelDelimiter方法的具体用法?PHP clsTinyButStrong::f_Misc_DelDelimiter怎么用?PHP clsTinyButStrong::f_Misc_DelDelimiter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类clsTinyButStrong
的用法示例。
在下文中一共展示了clsTinyButStrong::f_Misc_DelDelimiter方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: f_Misc_CheckCondition
static function f_Misc_CheckCondition($Str)
{
// Check if an expression like "exrp1=expr2" is true or false.
$StrZ = $Str;
// same string but without protected data
$Max = strlen($Str) - 1;
$p = strpos($Str, '\'');
if ($Esc = $p !== false) {
$In = true;
for ($p = $p + 1; $p <= $Max; $p++) {
if ($StrZ[$p] === '\'') {
$In = !$In;
} elseif ($In) {
$StrZ[$p] = 'z';
}
}
}
// Find operator and position
$Ope = '=';
$Len = 1;
$p = strpos($StrZ, $Ope);
if ($p === false) {
$Ope = '+';
$p = strpos($StrZ, $Ope);
if ($p === false) {
return false;
}
if ($p > 0 and $StrZ[$p - 1] === '-') {
$Ope = '-+';
$p--;
$Len = 2;
} elseif ($p < $Max and $StrZ[$p + 1] === '-') {
$Ope = '+-';
$Len = 2;
} else {
return false;
}
} else {
if ($p > 0) {
$x = $StrZ[$p - 1];
if ($x === '!') {
$Ope = '!=';
$p--;
$Len = 2;
} elseif ($x === '~') {
$Ope = '~=';
$p--;
$Len = 2;
} elseif ($p < $Max) {
$y = $StrZ[$p + 1];
if ($y === '=') {
$Len = 2;
} elseif ($x === '+' and $y === '-') {
$Ope = '+=-';
$p--;
$Len = 3;
} elseif ($x === '-' and $y === '+') {
$Ope = '-=+';
$p--;
$Len = 3;
}
} else {
}
}
}
// Read values
$Val1 = trim(substr($Str, 0, $p));
$Val2 = trim(substr($Str, $p + $Len));
if ($Esc) {
$Nude1 = clsTinyButStrong::f_Misc_DelDelimiter($Val1, '\'');
$Nude2 = clsTinyButStrong::f_Misc_DelDelimiter($Val2, '\'');
} else {
$Nude1 = $Nude2 = false;
}
// Compare values
if ($Ope === '=') {
return strcasecmp($Val1, $Val2) == 0;
} elseif ($Ope === '!=') {
return strcasecmp($Val1, $Val2) != 0;
} elseif ($Ope === '~=') {
return preg_match($Val2, $Val1) > 0;
} else {
if ($Nude1) {
$Val1 = '0' + $Val1;
}
if ($Nude2) {
$Val2 = '0' + $Val2;
}
if ($Ope === '+-') {
return $Val1 > $Val2;
} elseif ($Ope === '-+') {
return $Val1 < $Val2;
} elseif ($Ope === '+=-') {
return $Val1 >= $Val2;
} elseif ($Ope === '-=+') {
return $Val1 <= $Val2;
} else {
return false;
}
}
//.........这里部分代码省略.........