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

I wonder if you can help me. I am using the below code and
I wonder whether someone can help me please. The extract of script below enables
Is there anybody can help me interpret Edge points may be located by the
I'm still learning PHP Regex so I'm hoping someone can help me with what
May be you can help me: I have a tables: 1: Users id username
May be some one has had similar experiences on this dilemma and can help
Googled this topic unsuccessfully. May be you guys can help me out. Title is
may be you can help me. How can I create global object and function
May be you can help me with my task. I have a JSON string:
May be I can't explain exactly in words what I am trying to achieve,

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.