本文整理汇总了PHP中TYPO3\CMS\Core\Utility\MathUtility::calculateWithParentheses方法的典型用法代码示例。如果您正苦于以下问题:PHP MathUtility::calculateWithParentheses方法的具体用法?PHP MathUtility::calculateWithParentheses怎么用?PHP MathUtility::calculateWithParentheses使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\CMS\Core\Utility\MathUtility
的用法示例。
在下文中一共展示了MathUtility::calculateWithParentheses方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: stdWrap_prioriCalc
/**
* prioriCalc
* Will use the content as a mathematical term and calculate the result
* Can be set to 1 to just get a calculated value or 'intval' to get the integer of the result
*
* @param string $content Input value undergoing processing in this function.
* @param array $conf stdWrap properties for prioriCalc.
* @return string The processed input value
*/
public function stdWrap_prioriCalc($content = '', $conf = array())
{
$content = MathUtility::calculateWithParentheses($content);
if ($conf['prioriCalc'] === 'intval') {
$content = (int) $content;
}
return $content;
}
示例2: calculateWithParenthesesCorrectlyCalculatesExpression
/**
* @test
* @dataProvider calculateWithParenthesesDataProvider
*/
public function calculateWithParenthesesCorrectlyCalculatesExpression($expected, $expression)
{
$this->assertEquals($expected, \TYPO3\CMS\Core\Utility\MathUtility::calculateWithParentheses($expression));
}
示例3: stdWrap_prioriCalc
/**
* prioriCalc
* Will use the content as a mathematical term and calculate the result
* Can be set to 1 to just get a calculated value or 'intval' to get the integer of the result
*
* @param string $content Input value undergoing processing in this function.
* @param array $conf stdWrap properties for prioriCalc.
* @return string The processed input value
*/
public function stdWrap_prioriCalc($content = '', $conf = array())
{
$content = \TYPO3\CMS\Core\Utility\MathUtility::calculateWithParentheses($content);
if ($conf['prioriCalc'] == 'intval') {
$content = intval($content);
}
return $content;
}