I have a class as follows
class DatabaseConnectionDTO {
private $databaseServerName;
public function set($dbServerName){
$this->databaseServerName = $dbServerName;
}
public function get() {
return $this->databaseServerName;
}
}
This class is inside a DTO folder under the main project root folder. Under the project root folder I have another PHP file that is calling this class.
The file under the root folder :
require('./DTO/DatabaseConnectionDTO.php');
$databaseDTO = new DatabaseConnectionDTO;
$databaseDTO->set('Blaise Pascal');
echo $databaseDTO -> get();
My idea is to set the value of the property and display it on the page. However when I access the page on my browser I get the following
databaseServerName = $dbServerName;
}
public function get() {
return $this->databaseServerName;
}
}
?>
Is there something that I am missing here?
EDIT
When I place the DTO inside the same PHP file it starts working.. but that is not how I want it .. I want each and every DTO to be in a specific location.
Edit 2
Adding some snapshots


You have
<? php.You need to have
<?php.