wefixit_, Author at Fast Web Host. Literally https://fastweb.host/author/wefixit_/ The fastest web host you have ever experienced. Guaranteed. Mon, 14 Oct 2019 14:02:28 +0000 en-US hourly 1 https://fastweb.host/wp-content/uploads/2020/03/cropped-2020-icon-v2-32x32.png wefixit_, Author at Fast Web Host. Literally https://fastweb.host/author/wefixit_/ 32 32 What is difference between home URL and site URL https://fastweb.host/2019/10/what-is-difference-between-home-url-and-site-url/ https://fastweb.host/2019/10/what-is-difference-between-home-url-and-site-url/#respond Mon, 14 Oct 2019 14:02:28 +0000 https://fastweb.host/?p=6814 WordPress is the world’s most preferred website building platform and for good reason. It is very easy to set up and highly customizable. Sometimes it can be tricky to change...

The post What is difference between home URL and site URL appeared first on Fast Web Host. Literally.

]]>
WordPress is the world’s most preferred website building platform and for good reason. It is very easy to set up and highly customizable. Sometimes it can be tricky to change it when you move a website to different domains but thankfully there are more than one ways in which WordPress enabled us to change the site URL.

WordPress provides two configurable website URLs – WordPress address (also called SiteURL) and Site address (also called HomeURL). WordPress relies on these URLs to access your files and load the content correctly onto your website. Generally, the two addresses are filled out by default when you create a WordPress website. To change the URL of a WordPress website, you need to modify both the WordPress address and Site address URL.

There is a lot of confusion when it comes to understanding what WordPress address and Site address does, and why there are two addresses instead of one. In this article, we aim to demystify these URLs and give you an understanding of how to modify them.

So, what’s the difference between them?

The WordPress Address is where your admin pages are, along with all the other parts of WordPress, such as the folders “/wp-content/”, “/wp-include/” live. It is were the code or brains of your WordPress site reside.

The Site Address is the public-facing part of your site. It is the URL that visitors visit, and the URL you put on your business card.

Why are they sometimes different?

In a default WordPress installation, the two address are the same. But sometimes WordPress is in a different folder or directory than your public home page. Why? Here are a couple of the reasons why they may be different:

1) Your site has parts that are not WordPress based.
2) You want to keep your root directory free of WordPress folders and files.

If you currently have WordPress installed in your root folder, and want to move it to its own folder, the WordPress codex has instructions for that here: How to Give WordPress its own Directory.

The post What is difference between home URL and site URL appeared first on Fast Web Host. Literally.

]]>
https://fastweb.host/2019/10/what-is-difference-between-home-url-and-site-url/feed/ 0
Making string concatenation readable in PHP https://fastweb.host/2019/10/making-string-concatenation-readable-in-php/ https://fastweb.host/2019/10/making-string-concatenation-readable-in-php/#respond Mon, 14 Oct 2019 13:38:17 +0000 https://fastweb.host/?p=6810 robably all PHP developers know how to concatenate strings. The most popular method is using the .-operator. For small concatenations using this operator works fine. When lots of strings or variables...

The post Making string concatenation readable in PHP appeared first on Fast Web Host. Literally.

]]>
P robably all PHP developers know how to concatenate strings. The most popular method is using the .-operator. For small concatenations using this operator works fine. When lots of strings or variables need to be combined it can become cumbersome.

Here’s an example:

$logMessage = 'A '.$user->type.' with e-mailaddress '.$user->email.' has performed '.$action.' on '.$subject.'.';

Wow, my fingers hurt… While typing the most time is spent on making sure the quotes are open and closed on the right places. It also isn’t very readable. Especially the .'.' at the end make my eyes bleed.

A better way to create the string is to use the sprintf-function. This example produces the same string as the code above:

$logMessage = sprintf('A %s with email %s has performed %s on %s.', $user->type, $user->email, $action, $subject);

That’s much better. This is much easier to type and you don’t have to pay attention to opening an closing quotes. But my eyes still need to do a lot of work. To find out which string goes in which %s-placeholder you have to switch watching the beginning and end of the line of code.

There is another option to concatenate strings. It uses curly braces. Let’s take a look:

$logMessage = "A {$user->type} with e-mailaddress {$user->email} has performed {$action} on {$subject}."

In my mind this is much better. This option has the least amount of characters to type. Your eyes can just read the line of code from left to right to understand what’s going on. Keep in mind that this only works when using the curly braces between a double quote. The first character after the opening curly braces should be a dollar-sign.

The curly braces syntax works well if you only need to concatenate strings. As mentioned in the comments below this post, <a href="http://php.net/manual/en/function.sprintf.php">sprintf</a> might be a better fit when concatenating some other type of variable.

The post Making string concatenation readable in PHP appeared first on Fast Web Host. Literally.

]]>
https://fastweb.host/2019/10/making-string-concatenation-readable-in-php/feed/ 0