Asked  7 Months ago    Answers:  5   Viewed   20 times

I have my site on the server

On this server I have two domains: and

I would like to get the current domain using PHP, but if I use $_SERVER['HTTP_HOST'] then it is showing me

instead of: or

How can I get the domain, and not the server name?



Try using this:


Or parse :



Wednesday, March 31, 2021
answered 7 Months ago

I think something like this would give you the current CultureInfo:

CultureInfo currentCulture = Thread.CurrentThread.CurrentCulture;

Is that what you're looking for?

Tuesday, July 20, 2021
answered 3 Months ago

You need to revise your terminology a bit - CLGeocoder (and most geocoders) won't give you a 'city' per-se - it uses terms such as 'Administrative Area', 'Subadministrative Area', etc. The CLGeocoder object will return an array of CLPlacemark objects which you can then query for the information you need. You init a CLGeocoder and call the reverseGeocodeLocation function with a location and a completion block. Here's an example:

    if (osVersion() >= 5.0){

    CLGeocoder *reverseGeocoder = [[CLGeocoder alloc] init];

    [reverseGeocoder reverseGeocodeLocation:self.currentLocation completionHandler:^(NSArray *placemarks, NSError *error)
         DDLogVerbose(@"reverseGeocodeLocation:completionHandler: Completion Handler called!");
         if (error){
             DDLogError(@"Geocode failed with error: %@", error);

         DDLogVerbose(@"Received placemarks: %@", placemarks);

         CLPlacemark *myPlacemark = [placemarks objectAtIndex:0];
         NSString *countryCode = myPlacemark.ISOcountryCode;
         NSString *countryName =;
         DDLogVerbose(@"My country code: %@ and countryName: %@", countryCode, countryName);


Now note that the CLPlacemark doesn't have a 'city' property. The full list of properties can be found here: CLPlacemark Class Reference

Sunday, August 8, 2021
answered 3 Months ago

PhpStorm generates special temporary "wrapping" to execute the tests and get the output in the form it understands better. In your case it's /private/var/folders/qh/xjz1kr297v34pl6zy70_2rl00000gn/T/ide-phpunit.php. Since the error says there is a syntax error, the first thing you should try is deleting it, on the next run the IDE will create the new one, hopefully without that problem.

If that doesn't help, as suggested in the comments, try downgrading the PHPUnit a few versions back, see if that helps. Alternatively try reinstalling the PhpStorm. If that doesn't work, you have better chances of finding an answer by reporting an issue to the dev team.

Tuesday, August 24, 2021
answered 2 Months ago

It will be destructed (unloaded from memory) at the end of the page load, or if you unset all references to it earlier. You will not have to destroy it manually since PHP always cleans up all memory at the end of the script.

In fact, you should never call __destruct yourself. Use unset to unset the reference to an object when you want to destroy it. __destruct will in fact not destroy your object, it's just a function that will get called automatically by PHP just before the destruction so you get a chance to clean up before it's destroyed. You can call __destruct how many times as you want without getting your memory back.

If, however, you've saved the object to a session variable, it will "sleep" rather than be destroyed. See the manual for __sleep. It will still be unloaded from memory (and saved to disk) of course since PHP doesn't hold anything in memory between scripts.

Tuesday, October 12, 2021
answered 6 Days ago
Only authorized users can answer the question. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :