PHP - Using Php References
Actually i have a very large object thats persistent using sessions. That object have two large arrays, and other things. I have to extract each time that arrays.
Now im using: $configuracion = $_SESSION['reg']->GetInvConfig(); $categorias = $_SESSION['reg']->GetInvCategorias(); But if i get it well, this is copying all the array each time, no? i can use a reference to that array in the object easily to improve performace? Similar TutorialsHi there just wanted to ask you a general question regarding referenced variables and functions in PHP. I have this code: function theRefFunction(&$var){ $var = $var +1; return $var; } $a = 50; echo $thisvalue = theRefFunction($a); Just for learning purposes, as allot of times beginning PHP seriously developers who want to improve on memory consumption in PHP find this tricky, is there any point in using an example like this? I.e. would I really need the &$var as the parameter for the function called 'theRefFunction()'? Just wondered thats all, if not what would be a better way for really using it? It's just so I can go onto maybe doing a loop in it and setting it as a real example like working out tax and stuff like that, just for learning purposes, won't yet be using it. Just wanted to build up as I said earlier a library of things I have done and make maybe my own tutorial site. I look forward to any replies, Jeremy. I can not seem to get this to work so wondered if I can do this or not. Code: [Select] $_SESSION['ref123'] = "my item"; for some reason it is not storing when i try this, how do I allow letters ? I have been searching for a few weeks now and decided to get a little help on this on. I am after a database like that which I found for the UK postcode, but one for the USA but it needs to have the North and East references. Has anyone come across a site that offers a basic zipcode, state, Grid_N and Grid_E references ? if so please can you let me know what sites you have used. |