Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 510377
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T07:06:26+00:00 2026-05-13T07:06:26+00:00

May you can help me… many years ago my friend gave me php script

  • 0

May you can help me…
many years ago my friend gave me php script code presented below, now i want to change it can read numbering start from zero

existing just possible read 1:1, 10:200 etc.. but i want to make also possible read from 01:01, 0000002:0120 etc…

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.
 }

//--------------

thank you

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T07:06:26+00:00Added an answer on May 13, 2026 at 7:06 am

    You should make use of php internal functions like is_numeric and empty. And refrain from using string concatenation with empty strings (for whatever reason), instead just make sure those constants (I guess they are constants) are compatible and everything is fine.

    if ( isset( $teks['chapter'] ) && !is_numeric( $teks['chapter' ) )
    {
        if ( !empty( $teks['chapter'] ) )
            echo Chapter_need_number;
        unset( $teks['chapter'] );
    }
    
    if ( isset( $teks['verse'] ) && !is_numeric( $teks['verse'] ) )
    {
        $temp_array = explode( '_', teks['verse'], 2 );
        if ( count( $temp_array ) >= 2 && is_numeric( $temp_array[0] ) && is_numeric( $temp_array[1] ) )
        {
            $teks['verse'] = intval( $temp_array[0] );
            $teks['verse_end'] = intval( $temp_array[1] );
            if ( teks['verse_end'] <= teks['verse'] )
            {
                echo Verse_range_need_larger_ending;
                unset( $teks['verse'] );
                unset( $teks['verse_end'] );
            }
        }
        else
        {
            if ( !empty( $teks['verse'] ) )
                echo Verse_need_number;
            unset( $teks['verse'] );
        }
    }
    if ( isset( $teks['verse'] ) && !isset( $teks['chapter'] ) )
    {
        echo Verse_need_chapter;
        unset( $teks['verse'] );
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In PHP I can name my array indices so that I may have something
I'm still learning PHP Regex so I'm hoping someone can help me with what
May be some one has had similar experiences on this dilemma and can help
I can't tell from the Python documentation whether the re.compile(x) function may throw an
How can I get the (physical) installed path of a DLL that is (may
I'm may be missing something but I can't find the Delphi 2007 WSDL Importer
This may seem like a dumb question, but can an app build with c#
Anybody can help me to get date formated with Zend framework What I do
hope someone can help. I have two tables: Users -UserID -UserName UsersType -UserTypeID -UserID
hopefully someone can help me with this headache I have. I'm currently running Drupal

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.