愿你能帮助我...多年前我的朋友给了我下面介绍的 php 脚本代码,现在我想改变它可以读取从零开始的编号
现有的只是可能读取 1:1、10:200 等。但我想也可以从 01:01、0000002:0120 等读取...
function is_valid_number($sesuatu)
{
if(preg_match("/^([0-9]+)$/", $sesuatu)) return(TRUE);
else return(FALSE);
}
//--------------
if(isset($teks["chapter"]) && (is_valid_number($teks["chapter"]) === FALSE))
{
if(strcmp($teks["chapter"], "") != 0) echo "".Chapter_need_number.""; //bhs
unset($teks["chapter"]); //Just get rid of it.
}
if(isset($teks["verse"]) && (is_valid_number($teks["verse"]) === FALSE))
{
//There is a non-numerical character in verse. We /should/ be able to examine it for range.
$temp_array = explode("-", $teks["verse"], 2);
if(isset($temp_array[0]) && isset($temp_array[1]) && is_valid_number($temp_array[0]) === TRUE && is_valid_number($temp_array[1]) === TRUE)
{
$teks["verse"] = $temp_array[0];
$teks["verse_end"] = $temp_array[1];
// echo ("<h3>".Verse_range." \"" . $temp_array[0] . "\" - \"" . $temp_array[1] . "\"</h3>\n"); //bhs
if($teks["verse_end"] <= $teks["verse"])
{
echo "".Verse_range_need_larger_ending."";//bhs
unset($teks["verse"]);
unset($teks["verse_end"]);
}
}
else
{
if(strcmp($teks["verse"], "") != 0) echo "".Verse_need_number.""; //bhs
unset($teks["verse"]); //Just get rid of it.
}
}
if(isset($teks["verse"]) && !isset($teks["chapter"]))
{
echo "".Verse_need_chapter.""; //bhs
unset($teks["verse"]); //Just get rid of it.
}
//--------------
谢谢你