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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T03:09:13+00:00 2026-05-18T03:09:13+00:00

I am java and php programmer. In java i can use static class/method so

  • 0

I am java and php programmer.
In java i can use static class/method so that anyone can use the same one time created class during run-time.

But for php how to do it since it is script based and only run while we refreshing the page?

My main objective is, I want to use syncronized class/method so that it wont clash while executing the PHP…

Need your help to give input.
Thanks

Update:

  1. I am doing portal like multi level marketing(mlm)
  2. Once register a member, we should pay bonus to the uplines
  3. I don’t want immidiately calculate the bonus because it is risky and could take some time to finish, so is is better just to register the member and show successfull.
  4. My idea is, after registration, just invoke another class to run bonus with syncronized method so that the bonus calculation will not disturb by another registration.
  • 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-18T03:09:14+00:00Added an answer on May 18, 2026 at 3:09 am

    Given that a php scripts runs from new every sinlge time a “static” class would not be very different from an ordinary class.

    If you want to store some sort of state or preserve some data between runs of a php program then there are a number of options.

    SESSION variables can be used to store data between requests from a single users as long as he keeps the session open.

    COOKIES can be used to store data which persists between sessions as long as the user is using the same browser, on hte same machine and hasnt emptied the cookie jar.

    memchached and similar packages can be used to store data and make it available to any php program on the server.

    Databases are the most scalable solution as they will persist data between sessions, and between servers. There is some overhead involved is establishing connections and retrieving the data compared with the other solutions.

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

Sidebar

Related Questions

I'm a Java/PHP programmer learning C++. I've created a class called UserAccount and a
Im basically a php programmer and eventually i had to work on a java
I am relatively new to PHP, but experienced Java programmer in complex enterprise environments
I'm trying to implement RSA Encryption in both Java and PHP, but I can't
I am developing an app that has java files and php files. The java
my question is pretty simple: can PHP and Java communicate, while PHP being the
I'm PHP-programmer, but I'm extremely interested in learning Java. So I decided to change
I'm a long time Java programmer and I'm digging into Django recently to see
Trying to get a feel for haskell. Am a seasoned programmer with PHP, JAVA,
I'm a php programmer now doing a Java web project using Spring framework. I'm

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.