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 3424744
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T06:30:38+00:00 2026-05-18T06:30:38+00:00

I noticed in a lot of scripts ( like phpbb ) that some functions

  • 0

I noticed in a lot of scripts ( like phpbb ) that some functions are declared on the top of the script just to be used once. What the point of doing that? Are they used to make the code more readable?

For example I have a page that execute the user login, and the login is an action that can be done just there. So I declare a function for the login and I use it there.

  • 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-18T06:30:39+00:00Added an answer on May 18, 2026 at 6:30 am

    Yes, more readable is usually the aim. And sometimes, to leave the option of re-using the code in future. Remember, a function is usually a bit of a black box: if you know how to use it, you don’t really care how it works, so it can help the programmer keep track of what would otherwise be a long block of code.

    Edit: your login example is a good one. It’s entirely possible you’ll want to login from somewhere else in your site in future, in which case, having it as a function is a very good idea. Also, having login($username,$password) is a lot clearer than a load of database lookup and setcookie() bits.

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

Sidebar

Related Questions

I noticed that a lot of scripts have these type of comments: /** *
I've noticed that boost.asio has a lot of examples involving sockets, serial ports, and
I noticed that my Designer.vb file of one of my forms has a lot
I noticed that a lot of tutorial instructions often have this code: $sql=SELECT *
I've noticed some examples of things that work and don't work when dealing with
I've noticed a lot of sites, SO included, use XHTML as their mark-up language
I've noticed a lot of Microsoft sites have the *.MSPX extension. While I'm very
I've noticed a lot of talk about asp.net MVC lately, but I haven't come
I noticed that Google maps is providing directions in my local language (hungarian) when
I noticed that you can call Queue.Synchronize to get a thread-safe queue object, but

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.