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

  • Home
  • SEARCH
  • 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 6557115
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T13:01:58+00:00 2026-05-25T13:01:58+00:00

i don’t know if this can be done using php but it would be

  • 0

i don’t know if this can be done using php but it would be awesome for me if it did and php is pretty powerful so i think it is possible and i just can’t figure out how.

i know that a php file is executed from top to bottom but i would like to know if there is a way of stopping the execution at some point to then resume it on a later occasion or is there a way of reaching a certain part of it and then resuming from a part that is before it or something like that?

i know how to make this if i simply put each individual block of code on a separate php file, in this way it will stop because it reached the end of the file and if something happens it will resume from another file so it makes pretty much the same thing, but i would like to make a php script that would behave like this but contained in 1 php file.

i don’t need code examples i just need a nod in the right direction, like, some function names or something that could be useful to serve this purpose.

  • 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-25T13:01:59+00:00Added an answer on May 25, 2026 at 1:01 pm

    If you’re trying to do things based on user input, you should probably either:

    1. Structure your program as a web application, such that each bit of user input spawns a new request to the page with the block of code that input should execute, or…
    2. Use a different language than PHP.

    Assuming you’re doing #1, it’s not all that hard to have a particular GET parameter that specifies what “step” you’re on in the interaction – for instance, say you have a sequence of "A <user input> B or C <user input> D or E". You could have a URL scheme that looks like this:

    /app/code.php - this runs the code block A
    /app/code.php?step=B or /app/code.php?step=C - this runs either code block B or C
    /app/code.php?step=D or /app/code.php?step=E - this runs either code block D or E
    

    where the links/Javascript/whatever on the served pages allow choosing which page loads next. Your PHP file would look something like this:

    if(!isset($_GET['step'])) {
        // code block A
    } elseif($_GET['step'] == 'B') {
        // code block B
    } elseif($_GET['step'] == 'C') {
        // code block C
    } elseif($_GET['step'] == 'D') {
        // code block C
    } elseif($_GET['step'] == 'E') {
        // code block C
    } else {
        // error, invalid step specified
    }
    

    You could also simply split the steps up into different PHP files. Which approach would be best probably depends on how much functionality is shared between the different options, and how much is different – if lots is shared, a single file might be easier; if most is different, separate files are probably simpler.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Don't know why but I can't find a solution to this. I have 3
Don't really know how to formulate the title, but it should be pretty obvious
Don't know if this is the right place to ask this, but I will
Don't know if this is an eclipse specific problem but whenever I declare a
I don't know if this has been asked before, but what i'd like to
don't know if this is possible.. I'm using sqlite3 schema: CREATE TABLE docs (id
Don't ask me why but i can't use this method because I need to
(Don't know if this is strictly on-topic, but I don't see any better Stack
Don't need to do this right now but thinking about the future... What would
Don't know how to google for such, but is there a way to query

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.