1. Hey! Guest! The 35th GMC Jam will take place between November 28th, 12:00 UTC - December 2nd, 12:00 UTC. Why not join in! Click here to find out more!
    Dismiss Notice

PHP File Input / OutPut

Discussion in 'Off Topic' started by RizbIT, Sep 2, 2019.

Tags:
  1. RizbIT

    RizbIT Member

    Joined:
    Jun 24, 2016
    Posts:
    444
    Say you have a game or app that uses several different functions in a PHP file, using differen POST requests.

    For example to login, update account details on database, to update the highscores database.

    Is it better to have different PHP files for each request type?

    For example instead of myapp.php have
    login.php just for login requests
    profiles.php for updating user account
    highscores.php for updating or retrieving data from highscore db

    If you have 3 or more different php files will this decrease the 'workload' (like I/O, bandwith retrictions) and increase efficiency compared to having 1 PHP file that handles ALL backend stuff?
     
  2. Mercerenies

    Mercerenies Member

    Joined:
    Jun 21, 2016
    Posts:
    127
    No need to micro-optimize. The only thing you need to worry about is if you're using a free webhost who has some kind of arcane restriction (i.e. only 100 total files allowed or something). The bandwidth and other factors are simply not going to be affected significantly by this. Personally, I like to have one file act as an "entry-point" to all of the functionality, and then if I need a bunch of functionality, that one file will internally import other code. But that's me. Doesn't mean it's the only right way to do things.
     
    RizbIT likes this.

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice