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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T10:38:24+00:00 2026-05-20T10:38:24+00:00

I was wondering, is there a way to have a sort of variable that

  • 0

I was wondering, is there a way to have a sort of variable that would be ‘static’ meaning that it would be the same for all users in php ?
I know that there is a possibility to have a static variable within a function in php but that is not what I want.

I would like everyone to share an object which I would manipulate depending on the user’s demand.
Or, another example that is similar to what I want is, is there a way to keep a variable that counts the number of visitors (without using any sort of file or database manipulation). That variable would be incremented every time a user come to my page.

Cheers !

  • 1 1 Answer
  • 3 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-20T10:38:25+00:00Added an answer on May 20, 2026 at 10:38 am

    Without using a file or database, I believe you could do this using something like APC.

    $var = 1;
    $key = 'myVariable';
    apc_store($key, $var);
    echo apc_fetch($key); // 1
    

    If you want to increment it, you can use apc_inc()

    echo apc_inc($key); // 2
    

    However, this variable won’t be preserved if the cache is cleared (which happens when it fills up or the server is restarted).

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

Sidebar

Related Questions

I was wondering is there a way in PHP that you could tell where
I was wondering if there's any way to have a scipy.sparse.csc_matrix format for mlpy
Just wondering if there is a way in Spring to have a parent controller:
I am wondering if there is some way to make an box have the
If I have this line and I'm wondering if there's better way to do
I have two regular expressions: /\/(\w\w+)/g /(^\w\w+)/g and am wondering if there's any way
I was wondering if there was a way to have the Jira Script Runner
I was wondering what would be the fastest way to sort an array of
sort of a jQuery noobie here.. I am wondering if there is a way
I'm pretty sure I know the answer but I'm wondering if there's a way

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.