473,320 Members | 2,092 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

So a theory question for all you PHP Guru's out there

crabpot8
So I am building a web service that generates charts from a large amount of data. The problem I am running into is that to generate one chart, there can be up to 5 requests set. The variable preservation was just getting ridiculous.

So, question is - what is the best solution. I would like to have some sort of global variables, but register globals is turned off (I don't think that actually stops me from using the global keyword, just the globals array - please correct me if I am wrong)

My solution so far has been to create two files.
Expand|Select|Wrap|Line Numbers
  1. One is called set_globals, which declares an array and initializes all the key/value pairs to defaults. 
  2. THe second is called preserve variables, which simple checks if any request variables were sent and sets them in the array if they were not. At the top of the preserve variables file, I just require_once the set_globals. 
  3.  
I have included preserve variables in every script that needs it, and it seems to be working well.


So, is there a better way?
Jun 18 '08 #1
3 1142
Markus
6,050 Expert 4TB
I'm not too sure about the problem here, but could SESSIONs help?
Jun 18 '08 #2
dlite922
1,584 Expert 1GB
I'm not too sure about the problem here, but could SESSIONs help?
uh....Yah!

Why wouldn't session work?

If the data needs to be secure, save session in database.
Jun 19 '08 #3
Atli
5,058 Expert 4TB
... I would like to have some sort of global variables, but register globals is turned off (I don't think that actually stops me from using the global keyword, just the globals array - please correct me if I am wrong)...
Actually, the register_globals directive only disables / enables the automatic creation of global variables for all REQUEST variables.

It has no effect on either the global keyword or the $GLOBALS array.
Jun 20 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Xah Lee | last post by:
Dear functional programing comrades, Among the community of automatons of the IT industry, there is a popular quote about "theory vs practice" that goes something along the lines of "in theory...
16
by: Singulus | last post by:
Hello all, I've searched for similar threads, I've found some bit of useful info here and there, but nevertheless I want to post my questions...So, how can I (we, in fact the forum can benefit...
4
by: Andrey | last post by:
Hi, I will be hiring a php guru to help us architect a highly scalable web site/web application; the problem is I am coming from Microsoft .NET world and not too much familiar with the platform....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.