本文整理汇总了PHP中Text_Diff_Renderer_inline::sideBySide方法的典型用法代码示例。如果您正苦于以下问题:PHP Text_Diff_Renderer_inline::sideBySide方法的具体用法?PHP Text_Diff_Renderer_inline::sideBySide怎么用?PHP Text_Diff_Renderer_inline::sideBySide使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Text_Diff_Renderer_inline
的用法示例。
在下文中一共展示了Text_Diff_Renderer_inline::sideBySide方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: textDiff
/**
* Makes diff betweed 2 strings
* @param sring $source original data
* @param string $dest new data
* @param boolean $side_by_side side-by-side diff if set to true
* @return string diff
*/
private static function textDiff($source, $dest, $side_by_side = false)
{
$diff = new \Text_Diff('auto', array(explode("\n", $source), explode("\n", $dest)));
$renderer = new \Text_Diff_Renderer_inline();
$renderer->_leading_context_lines = 3;
$renderer->_trailing_context_lines = 3;
if ($side_by_side == false) {
$renderer->_split_level = 'words';
}
$res = $renderer->render($diff);
if ($side_by_side == true) {
$res = $renderer->sideBySide($res);
}
return $res;
}
示例2: fn_text_diff
function fn_text_diff($source, $dest, $side_by_side = false)
{
$diff = new Text_Diff('auto', array(explode("\n", $source), explode("\n", $dest)));
$renderer = new Text_Diff_Renderer_inline();
if ($side_by_side == false) {
$renderer->_split_level = 'words';
}
$res = $renderer->render($diff);
if ($side_by_side == true) {
$res = $renderer->sideBySide($res);
}
return $res;
}