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 posted this question: https://stackoverflow.com/questions/418597/java-and-net-for-php-programmer and the answers I was given didn't really help
I'm a longtime Java programmer working on a PHP project, and I'm trying to
I have a system that combines the best and worst of Java and PHP.
I'm implementing a JAX-WS webservice that will be consumed by external Java and PHP
What are the main differences between PHP and Java that someone proficient in PHP
Static variable gotcha in php I am from Java background and have switched to
What is the Java equivalent of PHP's $_POST ? After searching the web for
Im porting a project from php to java. The project is a web-app based
I am doing the following in PHP: exec('java -jar /opt/flex3/lib/mxmlc.jar +flexlib /opt/flex3/frameworks MyAS3App.as -default-size
I'm in the process of moving an application from PHP to Java and there

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.