Im trying to access a variable from one class through another class from a php script:
My first class is:
class data{
private $length;
private $height;
public function setLength($length){
$this->length = $length;
}
public function getLength(){
return $this->length;
}
public function setHeight($height){
$this->height = $height;
}
public function getHeight(){
return $this->height;
}
}
I have another class:
class proccess extends data{
public function getOrientation(){
if($this->getLength() > $this->getHeight()) {
$orientation = 'landscape';
} else {
$orientation = 'portrait';
}
}
}
When trying to access $this->getLenght() or $this-getHeight() from class process the values are empty; I am setting the values through my php script as so:
<?php
require_once('functions/data.php');
require_once('functions/process.php');
$data=new data();
$process = new process();
$data->setLength(25);
$data->setHeight(30);
$orientation = $process->getOrientation();
Any ideas on why the function getOrientation is not able to get the value of width and length and how i can fix this?