<?php
$top = 1;
function getTop() {
global $top;
$top ++;
return $top;
}?>

调用 <?=getTop()?><!-- return $top; 输出1开始 return $top-1; 输出0开始-->