当前位置: 首页>>代码示例>>PHP>>正文


PHP PHPVERSION函数代码示例

本文整理汇总了PHP中PHPVERSION函数的典型用法代码示例。如果您正苦于以下问题:PHP PHPVERSION函数的具体用法?PHP PHPVERSION怎么用?PHP PHPVERSION使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了PHPVERSION函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: get_trace_back

function get_trace_back()
{
    // based on PHP manual page for debug_backtrace()
    $trace_string = '';
    if (!version_compare(PHPVERSION(), '4.3', '>=')) {
        return $trace_string;
    }
    $trace = debug_backtrace();
    foreach ($trace as $line) {
        if (in_array($line['function'], array('raiseerror', 'trigger_error', 'errorhandlerdispatch', 'handleerror', 'handleframeworkerror', 'displaytraceback'))) {
            continue;
        }
        $trace_string .= '* ';
        if (isset($line['class'])) {
            $trace_string .= $line['class'];
            $trace_string .= ".";
        }
        $trace_string .= $line['function'];
        $trace_string .= "(";
        if (isset($line['args'])) {
            $sep = '';
            foreach ($line['args'] as $arg) {
                $trace_string .= $sep;
                $sep = ', ';
                if (is_null($arg)) {
                    $trace_string .= 'NULL';
                } elseif (is_array($arg)) {
                    $trace_string .= 'ARRAY[' . sizeof($arg) . ']';
                } elseif (is_object($arg)) {
                    $trace_string .= 'OBJECT:' . get_class($arg);
                } elseif (is_bool($arg)) {
                    $trace_string .= $arg ? 'TRUE' : 'FALSE';
                } else {
                    $trace_string .= '"';
                    $trace_string .= htmlspecialchars(substr((string) @$arg, 0, 32));
                    if (strlen($arg) > 32) {
                        $trace_string .= '...';
                    }
                    $trace_string .= '"';
                }
            }
        }
        $trace_string .= ")";
        if (isset($line['file'])) {
            $trace_string .= $line['file'];
            $trace_string .= " line ";
            $trace_string .= $line['line'];
        }
        $trace_string .= "\n\n";
    }
    return $trace_string;
}
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:52,代码来源:error.inc.php

示例2: fs_get_backtrace

function fs_get_backtrace()
{
    $s = '';
    if (PHPVERSION() >= 4.3) {
        $MAXSTRLEN = 64;
        $s = '<pre align=left>';
        $traceArr = debug_backtrace();
        array_shift($traceArr);
        array_shift($traceArr);
        $tabs = sizeof($traceArr) - 1;
        foreach ($traceArr as $arr) {
            //for ($i=0; $i < $tabs; $i++) $s .= '&nbsp;';
            $s .= "&nbsp;&nbsp;";
            $tabs -= 1;
            $s .= '<font face="Courier New,Courier">';
            if (isset($arr['class'])) {
                $s .= $arr['class'] . '.';
            }
            /*
            foreach($arr['args'] as $v) {
            	if (is_null($v)) $args[] = 'null';
            	else if (is_array($v)) $args[] = 'Array['.sizeof($v).']';
            	else if (is_object($v)) $args[] = 'Object:'.get_class($v);
            	else if (is_bool($v)) $args[] = $v ? 'true' : 'false';
            	else {
            		$v = (string) @$v;
            		$str = htmlspecialchars(substr($v,0,$MAXSTRLEN));
            		if (strlen($v) > $MAXSTRLEN) $str .= '...';
            		$args[] = $str;
            	}
            }
            */
            $line = isset($arr['line']) ? $arr['line'] : '?';
            $file = isset($arr['file']) ? $arr['file'] : '';
            $args = array();
            $s .= $arr['function'] . '(' . implode(', ', $args) . ')';
            if (!empty($file)) {
                $s .= sprintf("</font><font color=#808080 size=-1> # line %4d," . " file: <a href=\"file:/%s\">%s</a></font>", $line, $file, $file);
            } else {
                $s .= sprintf("</font><font color=#808080 size=-1> # line %4d," . " unknown file</font>", $line);
            }
            $s .= "\n";
        }
        $s .= '</pre>';
    }
    return $s;
}
开发者ID:alx,项目名称:blogsfera,代码行数:47,代码来源:errors.php

示例3: _adodb_backtrace

function _adodb_backtrace($printOrArr = true, $levels = 9999)
{
    if (PHPVERSION() < 4.3) {
        return '';
    }
    $html = isset($_SERVER['HTTP_USER_AGENT']);
    $fmt = $html ? "</font><font color=#808080 size=-1> %% line %4d, file: <a href=\"file:/%s\">%s</a></font>" : "%% line %4d, file: %s";
    $MAXSTRLEN = 64;
    $s = $html ? '<pre align=left>' : '';
    if (is_array($printOrArr)) {
        $traceArr = $printOrArr;
    } else {
        $traceArr = debug_backtrace();
    }
    array_shift($traceArr);
    array_shift($traceArr);
    $tabs = sizeof($traceArr) - 2;
    foreach ($traceArr as $arr) {
        $levels -= 1;
        if ($levels < 0) {
            break;
        }
        $args = array();
        for ($i = 0; $i < $tabs; $i++) {
            $s .= $html ? ' &nbsp; ' : "\t";
        }
        $tabs -= 1;
        if ($html) {
            $s .= '<font face="Courier New,Courier">';
        }
        if (isset($arr['class'])) {
            $s .= $arr['class'] . '.';
        }
        if (isset($arr['args'])) {
            foreach ($arr['args'] as $v) {
                if (is_null($v)) {
                    $args[] = 'null';
                } else {
                    if (is_array($v)) {
                        $args[] = 'Array[' . sizeof($v) . ']';
                    } else {
                        if (is_object($v)) {
                            $args[] = 'Object:' . get_class($v);
                        } else {
                            if (is_bool($v)) {
                                $args[] = $v ? 'true' : 'false';
                            } else {
                                $v = (string) @$v;
                                $str = htmlspecialchars(substr($v, 0, $MAXSTRLEN));
                                if (strlen($v) > $MAXSTRLEN) {
                                    $str .= '...';
                                }
                                $args[] = $str;
                            }
                        }
                    }
                }
            }
        }
        $s .= $arr['function'] . '(' . implode(', ', $args) . ')';
        $s .= @sprintf($fmt, $arr['line'], $arr['file'], basename($arr['file']));
        $s .= "\n";
    }
    if ($html) {
        $s .= '</pre>';
    }
    if ($printOrArr) {
        print $s;
    }
    return $s;
}
开发者ID:hetznerZA,项目名称:ipplan,代码行数:71,代码来源:adodb-lib.inc.php

示例4: adodb_backtrace

 function adodb_backtrace($print = true)
 {
     $s = '';
     if (PHPVERSION() >= 4.3) {
         $MAXSTRLEN = 64;
         $s = '<pre align=left>';
         $traceArr = debug_backtrace();
         array_shift($traceArr);
         $tabs = sizeof($traceArr) - 1;
         foreach ($traceArr as $arr) {
             for ($i = 0; $i < $tabs; $i++) {
                 $s .= ' &nbsp; ';
             }
             $tabs -= 1;
             $s .= '<font face="Courier New,Courier">';
             if (isset($arr['class'])) {
                 $s .= $arr['class'] . '.';
             }
             foreach ($arr['args'] as $v) {
                 if (is_null($v)) {
                     $args[] = 'null';
                 } else {
                     if (is_array($v)) {
                         $args[] = 'Array[' . sizeof($v) . ']';
                     } else {
                         if (is_object($v)) {
                             $args[] = 'Object:' . get_class($v);
                         } else {
                             if (is_bool($v)) {
                                 $args[] = $v ? 'true' : 'false';
                             } else {
                                 $v = (string) @$v;
                                 $str = htmlspecialchars(substr($v, 0, $MAXSTRLEN));
                                 if (strlen($v) > $MAXSTRLEN) {
                                     $str .= '...';
                                 }
                                 $args[] = $str;
                             }
                         }
                     }
                 }
             }
             $s .= $arr['function'] . '(' . implode(', ', $args) . ')';
             $s .= sprintf("</font><font color=#808080 size=-1> # line %4d, file: <a href=\"file:/%s\">%s</a></font>", $arr['line'], $arr['file'], $arr['file']);
             $s .= "\n";
         }
         $s .= '</pre>';
         if ($print) {
             print $s;
         }
     }
     return $s;
 }
开发者ID:parxomchik,项目名称:Agro,代码行数:53,代码来源:adodb.inc.php

示例5: bt

 function bt($levels = 9999, $iPrint = TRUE)
 {
     $s = '';
     if (PHPVERSION() >= 4.3) {
         $MAXSTRLEN = 64;
         $traceArr = debug_backtrace();
         array_shift($traceArr);
         $tabs = sizeof($traceArr) - 1;
         $indent = '';
         $sClass = '';
         foreach ($traceArr as $arr) {
             $levels -= 1;
             if ($levels < 0) {
                 break;
             }
             $args = array();
             for ($i = 0; $i <= $tabs; $i++) {
                 $indent .= '}';
             }
             $tabs -= 1;
             if (isset($arr['class'])) {
                 $sClass .= $arr['class'] . '::';
             }
             if (isset($arr['args'])) {
                 foreach ($arr['args'] as $v) {
                     if (is_null($v)) {
                         $args[] = 'null';
                     } elseif (is_array($v)) {
                         $args[] = 'Array[' . sizeof($v) . ']';
                     } elseif (is_object($v)) {
                         $args[] = 'Object:' . get_class($v);
                     } elseif (is_bool($v)) {
                         $args[] = $v ? 'true' : 'false';
                     } else {
                         $v = (string) @$v;
                         $str = htmlspecialchars(substr($v, 0, $MAXSTRLEN));
                         if (strlen($v) > $MAXSTRLEN) {
                             $str .= '...';
                         }
                         $args[] = $str;
                     }
                 }
             }
             if (!preg_match("*include*", $arr['function']) && !preg_match("*silentlog*", strtolower($arr['function']))) {
                 $s .= "\n    " . $indent . '    -> ';
                 $s .= $sClass . $arr['function'] . '(' . implode(', ', $args) . ')';
             }
             $s .= "\n    " . $indent;
             $s .= @sprintf(" LINE: %4d, %s", $arr['line'], $arr['file']);
             $indent = '';
         }
         $s .= "\n";
         if ($iPrint) {
             print '<pre>' . $s . "</pre>\n";
         }
     }
     return $s;
 }
开发者ID:bitweaver,项目名称:kernel,代码行数:58,代码来源:bit_error_inc.php

示例6: adodb_backtrace

function adodb_backtrace($print = true, $backtrace = array())
{
    $s = "Stack Trace:\n";
    if (PHPVERSION() >= 4.3) {
        $MAXSTRLEN = 64;
        $s = '<pre align=left>';
        if (count($backtrace) == 0) {
            // Fetch the backtrace
            $traceArr = debug_backtrace();
        } else {
            $traceArr = $backtrace;
        }
        $tabs = sizeof($traceArr) - 1;
        foreach ($traceArr as $arr) {
            for ($i = 0; $i < $tabs; $i++) {
                $s .= '  ';
            }
            $tabs -= 1;
            if (isset($arr['class'])) {
                $s .= $arr['class'] . '.';
            }
            $args = array();
            if (isset($arr['args'])) {
                foreach ($arr['args'] as $v) {
                    if (is_null($v)) {
                        $args[] = 'null';
                    } else {
                        if (is_array($v)) {
                            $args[] = 'Array[' . sizeof($v) . ']';
                        } else {
                            if (is_object($v)) {
                                $args[] = 'Object:' . get_class($v);
                            } else {
                                if (is_bool($v)) {
                                    $args[] = $v ? 'true' : 'false';
                                } else {
                                    $v = (string) @$v;
                                    $str = htmlspecialchars(substr($v, 0, $MAXSTRLEN));
                                    if (strlen($v) > $MAXSTRLEN) {
                                        $str .= '...';
                                    }
                                    $args[] = $str;
                                }
                            }
                        }
                    }
                }
            }
            $reg = array();
            if (ereg('/([0-9]{4}-[0-9]{2}-[0-9]{2}-[0-9]+)/(.+)$', $arr['file'], $reg)) {
                $href = SVN_REPOSITORY . '/releases/' . $reg[1] . '/' . $reg[2];
            } else {
                $href = 'file://' . $arr['file'];
            }
            $s .= $arr['function'] . '(' . implode(', ', $args) . ')';
            $s .= sprintf("</font><font color=#808080 size=-1> # line %4d," . " file: <a href=\"%s\">%s</a></font>", $arr['line'], $href, $arr['file']);
            $s .= "\n";
        }
        $s .= '</pre>';
        if ($print) {
            print $s;
        }
    }
    return $s;
}
开发者ID:schlos,项目名称:electionleaflets,代码行数:65,代码来源:error_handle.php


注:本文中的PHPVERSION函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。