When I run the following code:

<?php


$firstname = "First Name";
$middlename = "Middle Name";
$lastname = "Last Name";

$name = $firstname  .“ “. $middlename .” “. $lastname

echo $name

?>

This errors appears:

A sharing violation occured while accessing C:\xampp\htdocs\php_exercise\exercise1.php

why is it?

why didn't you missed semi colon for line numbers : 9 and 11.
try with this, if not success again post your error.

I did try those, the error remains the same. And I am unable to save the file.

Lines 9 and 11 should be terminated as mentioned by Shantic C. Also, your double quotes should be (" ") not (“ “). From what I can see, you typed lines 5 to 7 yourself and copied and pasted line 9 from somewhere. I encounter this problem anytime I copy from a PDF into notepad++. If I'm right, simply remove those quotes on line 9 and manually type them.

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.