Hi Everyone!

The title pretty much explains it all! I have a variable which holds the site's root url, but to make it work online and offline on my xampp, I need to make some differences. When the end variable is output, there are two "intermsediary" ones I used to hold stuff, like the position of a slash in a string.

Once I have the end variable is it advisable to unset() the ones I don't use any more? Does this just use up more resources than it gains?

I will be looking around the web for php efficiency and resource usage, but if you could point me to your favorite articles/locations I'd be really thankful.

Thanks a lot!

Recommended Answers

All 4 Replies

Can you provide Source code ?

I can, but I'm interested in the general application, php "theory" in a sense, not the actual example.

Once I have the end variable is it advisable to unset() the ones I don't use any more? Does this just use up more resources than it gains?

Well if it is a variable that is a few kilobytes in size and there is plenty of time left to execute then for sure use unset() to save resources. Also if your making a script that takes minutes or hours or even days to execute then unset may need to be used all the time to prevent memory leaks. And I haven't confirmed this yet but there might be something wrong with the bcmath library which requires unset(). So their your basic uses but as for regular variables like numbers/integres you shouldn't need to unset.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.